WithRestoreSpec restores the spec from the checkpoint for the container
(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index)
| 110 | |
| 111 | // WithRestoreSpec restores the spec from the checkpoint for the container |
| 112 | func 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 |
| 133 | func WithRestoreRW(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts { |
nothing calls this directly
no test coverage detected
searching dependent graphs…