Restore existing jobs and fix rebase (7c99eff3) issues

This commit is contained in:
Maximilian Paß
2021-06-10 09:26:17 +02:00
parent 0020590c96
commit 25d78df557
23 changed files with 487 additions and 130 deletions

View File

@@ -6,6 +6,9 @@ import (
// NomadEnvironmentStorage is an interface for storing NomadJobs.
type NomadEnvironmentStorage interface {
// List returns all keys of environments stored in this storage.
List() []EnvironmentID
// Add adds a job to the storage.
// It overwrites the old job if one with the same id was already stored.
Add(job *NomadEnvironment)
@@ -36,6 +39,14 @@ func NewLocalNomadJobStorage() *localNomadJobStorage {
}
}
func (s *localNomadJobStorage) List() []EnvironmentID {
keys := make([]EnvironmentID, 0, len(s.jobs))
for k := range s.jobs {
keys = append(keys, k)
}
return keys
}
func (s *localNomadJobStorage) Add(job *NomadEnvironment) {
s.Lock()
defer s.Unlock()