containerd/supervisor/get_containers.go
Michael Crosby 3dc59d565a Rename Events to task in supervisor
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-11 17:26:24 -08:00

20 lines
392 B
Go

package supervisor
type GetContainersTask struct {
s *Supervisor
}
func (h *GetContainersTask) Handle(e *Task) error {
if e.ID != "" {
ci := h.s.containers[e.ID]
if ci == nil {
return ErrContainerNotFound
}
e.Containers = append(e.Containers, ci.container)
return nil
}
for _, i := range h.s.containers {
e.Containers = append(e.Containers, i.container)
}
return nil
}