checkpoint.go 768 B

123456789101112131415161718192021222324252627282930313233343536
  1. // +build !windows
  2. package supervisor
  3. import "github.com/docker/containerd/runtime"
  4. type CreateCheckpointTask struct {
  5. baseTask
  6. ID string
  7. CheckpointDir string
  8. Checkpoint *runtime.Checkpoint
  9. }
  10. func (s *Supervisor) createCheckpoint(t *CreateCheckpointTask) error {
  11. i, ok := s.containers[t.ID]
  12. if !ok {
  13. return ErrContainerNotFound
  14. }
  15. return i.container.Checkpoint(*t.Checkpoint, t.CheckpointDir)
  16. }
  17. type DeleteCheckpointTask struct {
  18. baseTask
  19. ID string
  20. CheckpointDir string
  21. Checkpoint *runtime.Checkpoint
  22. }
  23. func (s *Supervisor) deleteCheckpoint(t *DeleteCheckpointTask) error {
  24. i, ok := s.containers[t.ID]
  25. if !ok {
  26. return ErrContainerNotFound
  27. }
  28. return i.container.DeleteCheckpoint(t.Checkpoint.Name, t.CheckpointDir)
  29. }