3 import "github.com/containerd/containerd/runtime"
5 // GetContainersTask holds needed parameters to retrieve a list of
7 type GetContainersTask struct {
10 GetState func(c runtime.Container) (interface{}, error)
12 Containers []runtime.Container
16 func (s *Supervisor) getContainers(t *GetContainersTask) error {
19 ci, ok := s.containers[t.ID]
21 return ErrContainerNotFound
23 t.Containers = append(t.Containers, ci.container)
24 if t.GetState != nil {
25 st, err := t.GetState(ci.container)
29 t.States = append(t.States, st)
35 for _, ci := range s.containers {
36 t.Containers = append(t.Containers, ci.container)
37 if t.GetState != nil {
38 st, err := t.GetState(ci.container)
42 t.States = append(t.States, st)