2016-02-26 03:18:10 +00:00
|
|
|
package supervisor
|
|
|
|
|
|
|
|
func (s *Supervisor) handleTask(i Task) {
|
|
|
|
var err error
|
|
|
|
switch t := i.(type) {
|
|
|
|
case *AddProcessTask:
|
|
|
|
err = s.addProcess(t)
|
|
|
|
case *CreateCheckpointTask:
|
|
|
|
err = s.createCheckpoint(t)
|
|
|
|
case *DeleteCheckpointTask:
|
|
|
|
err = s.deleteCheckpoint(t)
|
|
|
|
case *StartTask:
|
|
|
|
err = s.start(t)
|
|
|
|
case *DeleteTask:
|
|
|
|
err = s.delete(t)
|
|
|
|
case *ExitTask:
|
|
|
|
err = s.exit(t)
|
|
|
|
case *ExecExitTask:
|
|
|
|
err = s.execExit(t)
|
|
|
|
case *GetContainersTask:
|
|
|
|
err = s.getContainers(t)
|
|
|
|
case *SignalTask:
|
|
|
|
err = s.signal(t)
|
|
|
|
case *StatsTask:
|
|
|
|
err = s.stats(t)
|
|
|
|
case *UpdateTask:
|
|
|
|
err = s.updateContainer(t)
|
|
|
|
case *UpdateProcessTask:
|
|
|
|
err = s.updateProcess(t)
|
2016-02-29 22:15:16 +00:00
|
|
|
case *OOMTask:
|
|
|
|
err = s.oom(t)
|
2016-02-26 03:18:10 +00:00
|
|
|
default:
|
|
|
|
err = ErrUnknownTask
|
|
|
|
}
|
2016-04-02 17:28:05 +00:00
|
|
|
if err != errDeferredResponse {
|
2016-02-26 03:18:10 +00:00
|
|
|
i.ErrorCh() <- err
|
|
|
|
close(i.ErrorCh())
|
|
|
|
}
|
|
|
|
}
|