containerd/start.go
Michael Crosby 3010f209ff Refactor container info in supervisor
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-11 11:27:33 -08:00

27 lines
524 B
Go

package containerd
type StartEvent struct {
s *Supervisor
}
func (h *StartEvent) Handle(e *Event) error {
container, io, err := h.s.runtime.Create(e.ID, e.BundlePath)
if err != nil {
return err
}
h.s.containerGroup.Add(1)
h.s.containers[e.ID] = &containerInfo{
container: container,
}
ContainersCounter.Inc(1)
task := &StartTask{
Err: e.Err,
IO: io,
Container: container,
}
if e.Checkpoint != nil {
task.Checkpoint = e.Checkpoint.Name
}
h.s.tasks <- task
return errDeferedResponse
}