(ctx context.Context, client *containerd.Client, conInfo containers.Container, snapshotter string)
| 361 | } |
| 362 | |
| 363 | func mountSnapshotForContainer(ctx context.Context, client *containerd.Client, conInfo containers.Container, snapshotter string) (string, func() error, error) { |
| 364 | snapKey := conInfo.SnapshotKey |
| 365 | resp, err := client.SnapshotService(snapshotter).Mounts(ctx, snapKey) |
| 366 | if err != nil { |
| 367 | return "", nil, err |
| 368 | } |
| 369 | |
| 370 | tempDir, err := os.MkdirTemp("", "nerdctl-cp-") |
| 371 | if err != nil { |
| 372 | return "", nil, err |
| 373 | } |
| 374 | |
| 375 | err = mount.All(resp, tempDir) |
| 376 | if err != nil { |
| 377 | return "", nil, err |
| 378 | } |
| 379 | |
| 380 | cleanup := func() error { |
| 381 | err = mount.Unmount(tempDir, 0) |
| 382 | if err != nil { |
| 383 | return err |
| 384 | } |
| 385 | return os.RemoveAll(tempDir) |
| 386 | } |
| 387 | |
| 388 | return tempDir, cleanup, nil |
| 389 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…