2015-12-01 18:55:13 +00:00
|
|
|
package containerd
|
|
|
|
|
|
|
|
type StartEvent struct {
|
|
|
|
s *Supervisor
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *StartEvent) Handle(e *Event) error {
|
|
|
|
container, err := h.s.runtime.Create(e.ID, e.BundlePath, e.Stdio)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
h.s.containers[e.ID] = container
|
|
|
|
ContainersCounter.Inc(1)
|
2015-12-04 00:07:53 +00:00
|
|
|
task := &StartTask{
|
2015-12-03 01:42:28 +00:00
|
|
|
Err: e.Err,
|
|
|
|
Container: container,
|
2015-12-01 18:55:13 +00:00
|
|
|
}
|
2015-12-04 00:07:53 +00:00
|
|
|
if e.Checkpoint != nil {
|
|
|
|
task.Checkpoint = &Checkpoint{
|
|
|
|
Name: e.Checkpoint.Name,
|
|
|
|
Path: e.Checkpoint.Path,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
h.s.tasks <- task
|
2015-12-01 18:55:13 +00:00
|
|
|
return errDeferedResponse
|
|
|
|
}
|