wip: rename ID to JobId

This commit is contained in:
Michael Hohn
2024-06-04 13:04:51 -07:00
committed by =Michael Hohn
parent 0349961360
commit 593644ca2e
4 changed files with 12 additions and 11 deletions

View File

@@ -47,6 +47,6 @@ func (s Status) ToExternalString() string {
}
type JobSpec struct {
ID int
JobID int
OwnerRepo
}

View File

@@ -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,

View File

@@ -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) {