MCPcopy
hub / github.com/containerd/containerd / Restore

Method Restore

client/client.go:596–620  ·  view source on GitHub ↗

Restore restores a container from a checkpoint

(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts)

Source from the content-addressed store, hash-verified

594
595// Restore restores a container from a checkpoint
596func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error) {
597 store := c.ContentStore()
598 index, err := decodeIndex(ctx, store, checkpoint.Target())
599 if err != nil {
600 return nil, err
601 }
602
603 ctx, done, err := c.WithLease(ctx)
604 if err != nil {
605 return nil, err
606 }
607 defer done(ctx)
608
609 copts := make([]NewContainerOpts, len(opts))
610 for i, o := range opts {
611 copts[i] = o(ctx, id, c, checkpoint, index)
612 }
613
614 ctr, err := c.NewContainer(ctx, id, copts...)
615 if err != nil {
616 return nil, err
617 }
618
619 return ctr, nil
620}
621
622func writeIndex(ctx context.Context, index *ocispec.Index, client *Client, ref string) (d ocispec.Descriptor, err error) {
623 labels := map[string]string{}

Callers

nothing calls this directly

Calls 5

ContentStoreMethod · 0.95
WithLeaseMethod · 0.95
NewContainerMethod · 0.95
decodeIndexFunction · 0.85
TargetMethod · 0.65

Tested by

no test coverage detected