diff --git a/README.md b/README.md index 8ebceef..903d901 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Steps to build and run the server in a multi-container environment set up by doc 1. Start the containers cd ~/work-gh/mrva/mrvacommander/ + docker-compose down docker-compose up -d 4. Run server in its container diff --git a/pkg/common/types.go b/pkg/common/types.go index 670df5c..b9f34a7 100644 --- a/pkg/common/types.go +++ b/pkg/common/types.go @@ -47,6 +47,6 @@ func (s Status) ToExternalString() string { } type JobSpec struct { - ID int + JobID int OwnerRepo } diff --git a/pkg/server/server.go b/pkg/server/server.go index f7b88c6..f9ecc5e 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -62,9 +62,9 @@ func (c *CommanderSingle) StatusResponse(w http.ResponseWriter, js common.JobSpe slog.Debug("Submitting status response", "session", vaid) all_scanned := []common.ScannedRepo{} - jobs := storage.GetJobList(js.ID) + jobs := storage.GetJobList(js.JobID) for _, job := range jobs { - astat := storage.GetStatus(js.ID, job.ORL).ToExternalString() + astat := storage.GetStatus(js.JobID, job.ORL).ToExternalString() all_scanned = append(all_scanned, common.ScannedRepo{ Repository: common.Repository{ @@ -82,10 +82,10 @@ func (c *CommanderSingle) StatusResponse(w http.ResponseWriter, js common.JobSpe ) } - astat := storage.GetStatus(js.ID, js.OwnerRepo).ToExternalString() + astat := storage.GetStatus(js.JobID, js.OwnerRepo).ToExternalString() status := common.StatusResponse{ - SessionId: js.ID, + SessionId: js.JobID, ControllerRepo: common.ControllerRepo{}, Actor: common.Actor{}, QueryLanguage: ji.QueryLanguage, @@ -142,7 +142,7 @@ func (c *CommanderSingle) MirvaStatus(w http.ResponseWriter, r *http.Request) { job := spec[0] js := common.JobSpec{ - ID: job.QueryPackId, + JobID: job.QueryPackId, OwnerRepo: job.ORL, } @@ -169,7 +169,7 @@ func (c *CommanderSingle) MirvaDownloadArtifact(w http.ResponseWriter, r *http.R return } js := common.JobSpec{ - ID: vaid, + JobID: vaid, OwnerRepo: common.OwnerRepo{ Owner: vars["repo_owner"], Repo: vars["repo_name"], @@ -366,7 +366,7 @@ func submit_response(sn SessionInfo) ([]byte, error) { for _, job := range joblist { storage.SetJobInfo(common.JobSpec{ - ID: sn.ID, + JobID: sn.ID, OwnerRepo: job.ORL, }, common.JobInfo{ QueryLanguage: sn.Language, diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 1bd5575..df3707b 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -125,7 +125,7 @@ func GetResult(js common.JobSpec) common.AnalyzeResult { func SetResult(sessionid int, orl common.OwnerRepo, ar common.AnalyzeResult) { mutex.Lock() defer mutex.Unlock() - result[common.JobSpec{ID: sessionid, OwnerRepo: orl}] = ar + result[common.JobSpec{JobID: sessionid, OwnerRepo: orl}] = ar } func PackageResults(ar common.AnalyzeResult, owre common.OwnerRepo, vaid int) (zipPath string, e error) { @@ -206,7 +206,7 @@ func SetJobInfo(js common.JobSpec, ji common.JobInfo) { func GetStatus(sessionid int, orl common.OwnerRepo) common.Status { mutex.Lock() defer mutex.Unlock() - return status[common.JobSpec{ID: sessionid, OwnerRepo: orl}] + return status[common.JobSpec{JobID: sessionid, OwnerRepo: orl}] } func ResultAsFile(path string) (string, []byte, error) { @@ -227,7 +227,7 @@ func ResultAsFile(path string) (string, []byte, error) { func SetStatus(sessionid int, orl common.OwnerRepo, s common.Status) { mutex.Lock() defer mutex.Unlock() - status[common.JobSpec{ID: sessionid, OwnerRepo: orl}] = s + status[common.JobSpec{JobID: sessionid, OwnerRepo: orl}] = s } func AddJob(sessionid int, job common.AnalyzeJob) {