2016-02-26 03:18:10 +00:00
|
|
|
// +build !windows
|
|
|
|
|
2015-12-18 00:07:04 +00:00
|
|
|
package supervisor
|
2015-12-04 00:07:53 +00:00
|
|
|
|
2016-02-17 18:55:54 +00:00
|
|
|
import "github.com/docker/containerd/runtime"
|
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// CreateCheckpointTask holds needed parameters to create a new checkpoint
|
2016-02-12 01:26:24 +00:00
|
|
|
type CreateCheckpointTask struct {
|
2016-02-17 18:55:54 +00:00
|
|
|
baseTask
|
2016-05-26 00:42:37 +00:00
|
|
|
ID string
|
|
|
|
CheckpointDir string
|
|
|
|
Checkpoint *runtime.Checkpoint
|
2015-12-04 00:07:53 +00:00
|
|
|
}
|
|
|
|
|
2016-02-17 18:55:54 +00:00
|
|
|
func (s *Supervisor) createCheckpoint(t *CreateCheckpointTask) error {
|
|
|
|
i, ok := s.containers[t.ID]
|
2016-02-01 23:07:02 +00:00
|
|
|
if !ok {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
2016-05-26 00:42:37 +00:00
|
|
|
return i.container.Checkpoint(*t.Checkpoint, t.CheckpointDir)
|
2015-12-04 00:07:53 +00:00
|
|
|
}
|
2015-12-04 22:00:07 +00:00
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
// DeleteCheckpointTask holds needed parameters to delete a checkpoint
|
2016-02-12 01:26:24 +00:00
|
|
|
type DeleteCheckpointTask struct {
|
2016-02-17 18:55:54 +00:00
|
|
|
baseTask
|
2016-05-26 00:42:37 +00:00
|
|
|
ID string
|
|
|
|
CheckpointDir string
|
|
|
|
Checkpoint *runtime.Checkpoint
|
2015-12-04 22:00:07 +00:00
|
|
|
}
|
|
|
|
|
2016-02-17 18:55:54 +00:00
|
|
|
func (s *Supervisor) deleteCheckpoint(t *DeleteCheckpointTask) error {
|
|
|
|
i, ok := s.containers[t.ID]
|
2016-02-01 23:07:02 +00:00
|
|
|
if !ok {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
2016-05-26 00:42:37 +00:00
|
|
|
return i.container.DeleteCheckpoint(t.Checkpoint.Name, t.CheckpointDir)
|
2015-12-04 22:00:07 +00:00
|
|
|
}
|