Documentation
¶
Index ¶
- Variables
- func AllowInvalidMountsOnRestart(config *SnapshotterConfig) error
- func NewSnapshotter(ctx context.Context, root string, targetFs FileSystem, opts ...Opt) (snapshots.Snapshotter, error)
- func ParallelPullAsFallback(config *SnapshotterConfig) error
- func ParallelPullUnpack(config *SnapshotterConfig) error
- func WithAsynchronousRemove(config *SnapshotterConfig) error
- type FileSystem
- type Opt
- type SnapshotterConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoIndex is returned by `fs.Mount` when an image should not be lazy loaded // because a SOCI index was not found ErrNoIndex = errors.New("no valid SOCI index found") // ErrDeferToContainerRuntime is called when we cannot prepare a remote or local snapshot, // and must ask the container runtime to handle it instead. ErrDeferToContainerRuntime = errors.New("deferring to container runtime") // ErrNoZtoc is returned by `fs.Mount` when there is no zTOC for a particular layer. ErrNoZtoc = errors.New("no ztoc for layer") // ErrNoNamespace is used when the snapshot label is not present in the request ErrNoNamespace = errors.New("context has no namespace attached") )
Functions ¶
func AllowInvalidMountsOnRestart ¶
func AllowInvalidMountsOnRestart(config *SnapshotterConfig) error
func NewSnapshotter ¶
func NewSnapshotter(ctx context.Context, root string, targetFs FileSystem, opts ...Opt) (snapshots.Snapshotter, error)
NewSnapshotter returns a Snapshotter which can use unpacked remote layers as snapshots. This is implemented based on the overlayfs snapshotter, so diffs are stored under the provided root and a metadata file is stored under the root as same as overlayfs snapshotter.
func ParallelPullAsFallback ¶
func ParallelPullAsFallback(config *SnapshotterConfig) error
ParallelPullAsFallback configures the snapshotter to use parallel-pull as an automatic fallback when lazy-load is the primary mode but no SOCI index is found for an image. This avoids the slow sequential containerd pull that occurs when lazy-load is enabled and no SOCI index exists.
func ParallelPullUnpack ¶
func ParallelPullUnpack(config *SnapshotterConfig) error
func WithAsynchronousRemove ¶
func WithAsynchronousRemove(config *SnapshotterConfig) error
WithAsynchronousRemove defers removal of filesystem content until the Cleanup method is called. Removals will make the snapshot referred to by the key unavailable and make the key immediately available for re-use.
Types ¶
type FileSystem ¶
type FileSystem interface {
Mount(ctx context.Context, mountpoint string, labels map[string]string) error
Check(ctx context.Context, mountpoint string, labels map[string]string) error
Unmount(ctx context.Context, mountpoint string) error
MountLocal(ctx context.Context, mountpoint string, labels map[string]string, mounts []mount.Mount) error
MountParallel(ctx context.Context, mountpoint string, labels map[string]string, mounts []mount.Mount) error
IDMapMount(ctx context.Context, mountpoint, activeLayerID string, idmap idtools.IDMap) (string, error)
IDMapMountLocal(ctx context.Context, mountpoint, activeLayerID string, idmap idtools.IDMap) (string, error)
CleanImage(ctx context.Context, digest string) error
}
FileSystem is a backing filesystem abstraction.
Mount() tries to mount a remote snapshot to the specified mount point directory. If succeed, the mountpoint directory will be treated as a layer snapshot. If Mount() fails, the mountpoint directory MUST be cleaned up. Check() is called to check the connectibity of the existing layer snapshot every time the layer is used by containerd. Unmount() is called to unmount a remote snapshot from the specified mount point directory. MountLocal() is called to download and decompress a layer to a mount point directory. After that it applies the difference to the parent layers if there are any. If succeeded, the mountpoint directory will be treated as a regular layer snapshot. If MountLocal() fails, the mountpoint directory MUST be cleaned up.
type Opt ¶
type Opt func(config *SnapshotterConfig) error
Opt is an option to configure the remote snapshotter
func WithMinLayerSize ¶
WithMinLayerSize sets the smallest layer that will be mounted remotely.
type SnapshotterConfig ¶
type SnapshotterConfig struct {
// contains filtered or unexported fields
}
SnapshotterConfig is used to configure the remote snapshotter instance