MCPcopy
hub / github.com/containerd/containerd / WithTaskCheckpoint

Function WithTaskCheckpoint

client/task_opts.go:74–95  ·  view source on GitHub ↗

WithTaskCheckpoint allows a task to be created with live runtime and memory data from a previous checkpoint. Additional software such as CRIU may be required to restore a task from a checkpoint

(im Image)

Source from the content-addressed store, hash-verified

72// previous checkpoint. Additional software such as CRIU may be required to
73// restore a task from a checkpoint
74func WithTaskCheckpoint(im Image) NewTaskOpts {
75 return func(ctx context.Context, c *Client, info *TaskInfo) error {
76 desc := im.Target()
77 id := desc.Digest
78 index, err := decodeIndex(ctx, c.ContentStore(), desc)
79 if err != nil {
80 return err
81 }
82 for _, m := range index.Manifests {
83 if m.MediaType == images.MediaTypeContainerd1Checkpoint {
84 info.Checkpoint = &types.Descriptor{
85 MediaType: m.MediaType,
86 Size: m.Size,
87 Digest: m.Digest.String(),
88 Annotations: m.Annotations,
89 }
90 return nil
91 }
92 }
93 return fmt.Errorf("checkpoint not found in index %s", id)
94 }
95}
96
97// WithCheckpointName sets the image name for the checkpoint
98func WithCheckpointName(name string) CheckpointTaskOpts {

Callers 3

TestCheckpointRestorePTYFunction · 0.85
TestCheckpointRestoreFunction · 0.85

Calls 4

decodeIndexFunction · 0.85
TargetMethod · 0.65
ContentStoreMethod · 0.65
StringMethod · 0.45

Tested by 3

TestCheckpointRestorePTYFunction · 0.68
TestCheckpointRestoreFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…