2015-12-18 00:07:04 +00:00
|
|
|
package supervisor
|
2015-12-04 00:07:53 +00:00
|
|
|
|
2016-02-12 01:26:24 +00:00
|
|
|
type CreateCheckpointTask struct {
|
2015-12-04 00:07:53 +00:00
|
|
|
s *Supervisor
|
|
|
|
}
|
|
|
|
|
2016-02-12 01:26:24 +00:00
|
|
|
func (h *CreateCheckpointTask) Handle(e *Task) error {
|
2016-02-01 23:07:02 +00:00
|
|
|
i, ok := h.s.containers[e.ID]
|
|
|
|
if !ok {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
|
|
|
return i.container.Checkpoint(*e.Checkpoint)
|
2015-12-04 00:07:53 +00:00
|
|
|
}
|
2015-12-04 22:00:07 +00:00
|
|
|
|
2016-02-12 01:26:24 +00:00
|
|
|
type DeleteCheckpointTask struct {
|
2015-12-04 22:00:07 +00:00
|
|
|
s *Supervisor
|
|
|
|
}
|
|
|
|
|
2016-02-12 01:26:24 +00:00
|
|
|
func (h *DeleteCheckpointTask) Handle(e *Task) error {
|
2016-02-01 23:07:02 +00:00
|
|
|
i, ok := h.s.containers[e.ID]
|
|
|
|
if !ok {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
|
|
|
return i.container.DeleteCheckpoint(e.Checkpoint.Name)
|
2015-12-04 22:00:07 +00:00
|
|
|
}
|