(id string, i Image, readonly bool, opts ...snapshots.Opt)
| 250 | } |
| 251 | |
| 252 | func withNewSnapshot(id string, i Image, readonly bool, opts ...snapshots.Opt) NewContainerOpts { |
| 253 | return func(ctx context.Context, client *Client, c *containers.Container) error { |
| 254 | diffIDs, err := i.RootFS(ctx) |
| 255 | if err != nil { |
| 256 | return err |
| 257 | } |
| 258 | |
| 259 | parent := identity.ChainID(diffIDs).String() |
| 260 | c.Snapshotter, err = client.resolveSnapshotterName(ctx, c.Snapshotter) |
| 261 | if err != nil { |
| 262 | return err |
| 263 | } |
| 264 | s, err := client.getSnapshotter(ctx, c.Snapshotter) |
| 265 | if err != nil { |
| 266 | return err |
| 267 | } |
| 268 | parent, err = resolveSnapshotOptions(ctx, client, c.Snapshotter, s, parent, opts...) |
| 269 | if err != nil { |
| 270 | return err |
| 271 | } |
| 272 | |
| 273 | if readonly { |
| 274 | _, err = s.View(ctx, id, parent, opts...) |
| 275 | } else { |
| 276 | _, err = s.Prepare(ctx, id, parent, opts...) |
| 277 | } |
| 278 | if err != nil { |
| 279 | return err |
| 280 | } |
| 281 | c.SnapshotKey = id |
| 282 | c.Image = i.Name() |
| 283 | return nil |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | // WithContainerExtension appends extension data to the container object. |
| 288 | // Use this to decorate the container object with additional data for the client |
no test coverage detected
searching dependent graphs…