Move supervisor to it's own package

It allows to keep main namespace cleaner

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-12-17 16:07:04 -08:00
parent b296d50493
commit 69f8f566a2
24 changed files with 61 additions and 59 deletions

31
supervisor/create.go Normal file
View file

@ -0,0 +1,31 @@
package supervisor
type StartEvent struct {
s *Supervisor
}
func (h *StartEvent) Handle(e *Event) error {
container, io, err := h.s.runtime.Create(e.ID, e.BundlePath, e.Console)
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,
Stdin: e.Stdin,
Stdout: e.Stdout,
Stderr: e.Stderr,
StartResponse: e.StartResponse,
}
if e.Checkpoint != nil {
task.Checkpoint = e.Checkpoint.Name
}
h.s.tasks <- task
return errDeferedResponse
}