MCPcopy
hub / github.com/containerd/containerd / WithRestoreRW

Function WithRestoreRW

client/container_restore_opts.go:133–150  ·  view source on GitHub ↗

WithRestoreRW restores the rw layer 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

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 {
134 return func(ctx context.Context, client *Client, c *containers.Container) error {
135 // apply rw layer
136 rw, err := GetIndexByMediaType(index, imagespec.MediaTypeImageLayerGzip)
137 if err != nil {
138 return err
139 }
140 mounts, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, c.SnapshotKey)
141 if err != nil {
142 return err
143 }
144
145 if _, err := client.DiffService().Apply(ctx, *rw, mounts); err != nil {
146 return err
147 }
148 return nil
149 }
150}

Callers

nothing calls this directly

Calls 5

GetIndexByMediaTypeFunction · 0.85
DiffServiceMethod · 0.80
MountsMethod · 0.65
SnapshotServiceMethod · 0.65
ApplyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…