Implement review suggestions

This commit is contained in:
Maximilian Paß
2021-12-17 17:09:01 +01:00
parent 0571b10b5c
commit d57a0c07b8
10 changed files with 104 additions and 106 deletions

View File

@@ -21,6 +21,9 @@ type Storage interface {
// It does nothing if no runner with the id is present in the store.
Delete(id string)
// Purge removes all runners from the storage.
Purge()
// Length returns the number of currently stored runners in the storage.
Length() int
@@ -72,6 +75,12 @@ func (s *localRunnerStorage) Delete(id string) {
delete(s.runners, id)
}
func (s *localRunnerStorage) Purge() {
s.Lock()
defer s.Unlock()
s.runners = make(map[string]Runner)
}
func (s *localRunnerStorage) Sample() (Runner, bool) {
s.Lock()
defer s.Unlock()