Add statistics route for execution environments
* Add statistics route for execution environments * Add maximum to port api definition Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,9 @@ import (
|
||||
|
||||
// Storage is an interface for storing runners.
|
||||
type Storage interface {
|
||||
// List returns all runners from the storage.
|
||||
List() []Runner
|
||||
|
||||
// Add adds a runner to the storage.
|
||||
// It overwrites the old runner if one with the same id was already stored.
|
||||
Add(Runner)
|
||||
@@ -41,6 +44,15 @@ func NewLocalRunnerStorage() *localRunnerStorage {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *localRunnerStorage) List() (r []Runner) {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
for _, value := range s.runners {
|
||||
r = append(r, value)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func (s *localRunnerStorage) Add(r Runner) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
Reference in New Issue
Block a user