MCPcopy
hub / github.com/containerd/containerd / WithRestoreSpec

Function WithRestoreSpec

client/container_restore_opts.go:112–130  ·  view source on GitHub ↗

WithRestoreSpec restores the spec from the checkpoint for the container

(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index)

Source from the content-addressed store, hash-verified

110
111// WithRestoreSpec restores the spec from the checkpoint for the container
112func WithRestoreSpec(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts {
113 return func(ctx context.Context, client *Client, c *containers.Container) error {
114 m, err := GetIndexByMediaType(index, images.MediaTypeContainerd1CheckpointConfig)
115 if err != nil {
116 return err
117 }
118 store := client.ContentStore()
119 data, err := content.ReadBlob(ctx, store, *m)
120 if err != nil {
121 return fmt.Errorf("unable to read checkpoint config: %w", err)
122 }
123 var any ptypes.Any
124 if err := proto.Unmarshal(data, &any); err != nil {
125 return err
126 }
127 c.Spec = &any
128 return nil
129 }
130}
131
132// WithRestoreRW restores the rw layer from the checkpoint for the container
133func WithRestoreRW(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts {

Callers

nothing calls this directly

Calls 4

ReadBlobFunction · 0.92
UnmarshalFunction · 0.92
GetIndexByMediaTypeFunction · 0.85
ContentStoreMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…