snapshot

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error returned by `fs.Mount` when there is no ztoc for a particular layer.
	ErrNoZtoc = errors.New("no ztoc for layer")
)

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 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
}

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

func WithMinLayerSize(minLayerSize int64) Opt

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL