wip: add analysis runner / agent, separate Server/Queue/Agent, use New* initializers

This commit is contained in:
Michael Hohn
2024-05-23 15:46:55 -07:00
committed by =Michael Hohn
parent 2ab596bf1d
commit f7155eba50
10 changed files with 209 additions and 22 deletions

View File

@@ -27,6 +27,11 @@ type StorageSingle struct {
CurrentID int
}
func NewStorageSingle(startingID int) *StorageSingle {
s := StorageSingle{CurrentID: startingID}
return &s
}
func (s *StorageSingle) NextID() int {
s.CurrentID += 1
return s.CurrentID
@@ -121,6 +126,12 @@ func GetResult(js common.JobSpec) common.AnalyzeResult {
return ar
}
func SetResult(sessionid int, orl common.OwnerRepo, ar common.AnalyzeResult) {
mutex.Lock()
defer mutex.Unlock()
result[common.JobSpec{ID: sessionid, OwnerRepo: orl}] = ar
}
func PackageResults(ar common.AnalyzeResult, owre common.OwnerRepo, vaid int) (zipPath string, e error) {
slog.Debug("Readying zip file with .sarif/.bqrs", "analyze-result", ar)