snapshotter

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operator

type Operator struct {
	// contains filtered or unexported fields
}

Operator communicates with the containerd interface. Because containerd would cache snapshot information, therefore, we need to communicate with containerd to update the information we have. On the other side, the Plugin class communicates with the snapshotter plugin interface

func NewOperator

func NewOperator(ctx context.Context, client OperatorClient, sn snapshots.Snapshotter) *Operator

func (*Operator) AddSnapshot

func (op *Operator) AddSnapshot(name, parent, imageDigest, uncompressedDigest string, stack int64) (sn *snapshots.Info, err error)

func (*Operator) ScanSnapshots

func (op *Operator) ScanSnapshots() (err error)

type OperatorClient

type OperatorClient interface {
	// GetFilesystemRoot gets the directory to store all layers
	GetFilesystemRoot() string

	// AddCompletedLayers find out completed layer and save it to Client's layerMap
	AddCompletedLayers(compressedLayerDigest string)
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin(ctx context.Context, client PluginClient, metadataDB string) (s *Plugin, err error)

func (*Plugin) Close

func (s *Plugin) Close() error

Close releases the internal resources.

Close is expected to be called on the end of the lifecycle of the snapshotter, but not mandatory.

Close returns nil when it is already closed.

func (*Plugin) Commit

func (s *Plugin) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) (err error)

func (*Plugin) Mounts

func (s *Plugin) Mounts(ctx context.Context, key string) ([]mount.Mount, error)

func (*Plugin) Prepare

func (s *Plugin) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error)

func (*Plugin) Remove

func (s *Plugin) Remove(ctx context.Context, key string) (err error)

Remove the committed or active snapshot by the provided key.

All resources associated with the key will be removed.

If the snapshot is a parent of another snapshot, its children must be removed before proceeding.

func (*Plugin) Stat

func (s *Plugin) Stat(ctx context.Context, key string) (snapshots.Info, error)

func (*Plugin) Update

func (s *Plugin) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error)

func (*Plugin) Usage

func (s *Plugin) Usage(ctx context.Context, key string) (snapshots.Usage, error)

func (*Plugin) View

func (s *Plugin) View(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error)

func (*Plugin) Walk

func (s *Plugin) Walk(ctx context.Context, fn snapshots.WalkFunc, fs ...string) error

Walk will call the provided function for each snapshot in the snapshotter which match the provided filters. If no filters are given all items will be walked. Filters:

name
parent
kind (active,view,committed)
labels.(label)

type PluginClient

type PluginClient interface {

	// GetFilesystemPath only use this for starlightfs' stat
	GetFilesystemPath(compressDigest string) string

	// GetMountingPoint returns the path of the snapshotter's mounting point, considering
	// getUpper, getWork, getStarlightFS functions instead of using this function directly
	GetMountingPoint(ssId string) string

	// PrepareManager inform the client to load specified manager in memory.
	// It requires the manifest, Starlight Metadatain and image config is present in containerd's content storage.
	// In case the above requirements are not met, the client should return an error.
	// The plugin should then try the next referenced manager (manifest digest).
	PrepareManager(namespace string, manifest digest.Digest) (err error)

	// Unmount starlightfs
	Unmount(compressDigest, key string) error

	// Mount starlightfs
	Mount(layerDigest digest.Digest, snapshotId string, sn *snapshots.Info) (mnt string, err error)
}

type SnapshotItem

type SnapshotItem struct {
	// contains filtered or unexported fields
}

func (SnapshotItem) GetStarlightFeature

func (si SnapshotItem) GetStarlightFeature() (md, und digest.Digest, stack int64)

GetStarlightFeature returns manifest digest, uncompressed digest, and stack number

func (SnapshotItem) IsStarlightFS

func (si SnapshotItem) IsStarlightFS() bool

Jump to

Keyboard shortcuts

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