github.com/georgethebeatle/containerd@v0.2.5/supervisor/checkpoint.go (about)

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