move rw to opt; make snapshot opt; move to NewContainerOpts
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
26
client.go
26
client.go
@@ -538,11 +538,7 @@ func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts
|
||||
|
||||
copts := []NewContainerOpts{}
|
||||
for _, o := range opts {
|
||||
co, err := o(ctx, id, c, checkpoint, index)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
copts = append(copts, co...)
|
||||
copts = append(copts, o(ctx, id, c, checkpoint, index))
|
||||
}
|
||||
|
||||
ctr, err := c.NewContainer(ctx, id, copts...)
|
||||
@@ -550,26 +546,6 @@ func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// apply rw layer
|
||||
info, err := ctr.Info(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rw, err := GetIndexByMediaType(index, ocispec.MediaTypeImageLayerGzip)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mounts, err := c.SnapshotService(info.Snapshotter).Mounts(ctx, info.SnapshotKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err := c.DiffService().Apply(ctx, *rw, mounts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ctr, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user