snapshots

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocked = errors.New("locked")
)
View Source
var ErrNoBlobs = errors.Errorf("no blobs for snapshot")
View Source
var NoUpdateLastUsed noUpdateLastUsed

Functions

func EnsureLease

func EnsureLease(ctx context.Context) (context.Context, error)

func HasLazyLease

func HasLazyLease(ctx context.Context) bool

func IsNotFound

func IsNotFound(err error) bool

func MakeTemporary

func MakeTemporary(l *leases.Lease) error

func WithLazyLease

func WithLazyLease(ctx context.Context, lm leases.Manager, opts ...leases.Opt) (context.Context, func(context.Context) error, error)

func WithLease

func WithLease(ctx context.Context, ls leases.Manager, opts ...leases.Opt) (context.Context, func(context.Context) error, error)

func WithoutLazyLease

func WithoutLazyLease(ctx context.Context) context.Context

Types

type Accessor

type Accessor interface {
	MetadataStore

	Get(ctx context.Context, id string, opts ...RefOption) (ImmutableRef, error)
	GetBySnapshotID(ctx context.Context, snapshotID string, opts ...RefOption) (ImmutableRef, error)

	New(ctx context.Context, parent ImmutableRef, opts ...RefOption) (MutableRef, error)
	GetMutable(ctx context.Context, id string, opts ...RefOption) (MutableRef, error) // Rebase?
	GetMutableBySnapshotID(ctx context.Context, snapshotID string, opts ...RefOption) (MutableRef, error)
	ImportImage(ctx context.Context, img *ImportedImage, opts ImportImageOpts) (ImmutableRef, error)
	ApplySnapshotDiff(ctx context.Context, lower, upper ImmutableRef, opts ...RefOption) (ImmutableRef, error)
	Merge(ctx context.Context, parents []ImmutableRef, opts ...RefOption) (ImmutableRef, error)
}

type Diff

type Diff struct {
	Lower      string
	Upper      string
	Comparison fsdiff.Comparison
}

type ExportChain

type ExportChain struct {
	Layers   []ExportLayer
	Provider content.InfoReaderProvider
}

type ExportLayer

type ExportLayer struct {
	Descriptor  ocispecs.Descriptor
	Description string
	CreatedAt   *time.Time
}

type ImmutableRef

type ImmutableRef interface {
	Ref
	ExportChain(ctx context.Context, cfg config.RefConfig) (*ExportChain, error)
}

type ImportImageOpts

type ImportImageOpts struct {
	ImageRef   string
	RecordType client.UsageRecordType
}

type ImportedImage

type ImportedImage struct {
	Ref          string
	ManifestDesc ocispecs.Descriptor
	ConfigDesc   ocispecs.Descriptor
	Layers       []ocispecs.Descriptor
	Nonlayers    []ocispecs.Descriptor
}

type ImportedLayerBlobKey

type ImportedLayerBlobKey struct {
	ParentSnapshotID string
	BlobDigest       digest.Digest
}

type ImportedLayerBlobRow

type ImportedLayerBlobRow struct {
	ParentSnapshotID string
	BlobDigest       digest.Digest
	SnapshotID       string
}

type ImportedLayerDiffKey

type ImportedLayerDiffKey struct {
	ParentSnapshotID string
	DiffID           digest.Digest
}

type ImportedLayerDiffRow

type ImportedLayerDiffRow struct {
	ParentSnapshotID string
	DiffID           digest.Digest
	SnapshotID       string
}

type LeaseManager

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

func NewLeaseManager

func NewLeaseManager(lm leases.Manager, ns string) *LeaseManager

func (*LeaseManager) AddResource

func (l *LeaseManager) AddResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error

func (*LeaseManager) Create

func (l *LeaseManager) Create(ctx context.Context, opts ...leases.Opt) (leases.Lease, error)

func (*LeaseManager) Delete

func (l *LeaseManager) Delete(ctx context.Context, lease leases.Lease, opts ...leases.DeleteOpt) error

func (*LeaseManager) DeleteResource

func (l *LeaseManager) DeleteResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error

func (*LeaseManager) List

func (l *LeaseManager) List(ctx context.Context, filters ...string) ([]leases.Lease, error)

func (*LeaseManager) ListResources

func (l *LeaseManager) ListResources(ctx context.Context, lease leases.Lease) ([]leases.Resource, error)

func (*LeaseManager) Namespace

func (l *LeaseManager) Namespace() string

func (*LeaseManager) WithNamespace

func (l *LeaseManager) WithNamespace(ns string) *LeaseManager

type LeaseRef

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

func NewLease

func NewLease(ctx context.Context, lm leases.Manager, opts ...leases.Opt) (*LeaseRef, context.Context, error)

func (*LeaseRef) Adopt

func (l *LeaseRef) Adopt(ctx context.Context) error

func (*LeaseRef) Discard

func (l *LeaseRef) Discard() error

type LocalMounterOpt

type LocalMounterOpt func(*localMounter)

func ForceRemount

func ForceRemount() LocalMounterOpt

type MergeSnapshotter

type MergeSnapshotter interface {
	Snapshotter
	Merge(ctx context.Context, key string, diffs []Diff, opts ...snapshots.Opt) error
}

func NewMergeSnapshotter

func NewMergeSnapshotter(ctx context.Context, sn Snapshotter, lm leases.Manager) MergeSnapshotter

type MetadataStore

type MetadataStore interface {
	Search(context.Context, string, bool) ([]RefMetadata, error)
}

type Mountable

type Mountable interface {
	Mount(ctx context.Context, readonly bool) (MountableRef, error)
}

type MountableRef

type MountableRef = executor.MountableRef

type Mounter

type Mounter interface {
	Mount() (string, error)
	Unmount() error
}

func LocalMounter

func LocalMounter(mountable MountableRef, opts ...LocalMounterOpt) Mounter

func LocalMounterWithMounts

func LocalMounterWithMounts(mounts []mount.Mount, opts ...LocalMounterOpt) Mounter

type MutableRef

type MutableRef interface {
	Ref
	Commit(context.Context) (ImmutableRef, error)
	InvalidateSize(context.Context) error
}

type PersistentMetadataRows

type PersistentMetadataRows struct {
	SnapshotContent []SnapshotContentRow
	ImportedByBlob  []ImportedLayerBlobRow
	ImportedByDiff  []ImportedLayerDiffRow
}

type Ref

type Ref interface {
	Mountable
	ID() string
	SnapshotID() string
	Release(context.Context) error
	Size(context.Context) (int64, error)
}

Ref is a reference to cacheable objects.

type RefMetadata

type RefMetadata interface {
	ID() string
	SnapshotID() string

	GetDescription() string
	SetDescription(string) error

	GetCreatedAt() time.Time
	SetCreatedAt(time.Time) error

	GetLayerType() string
	SetLayerType(string) error

	GetRecordType() client.UsageRecordType
	SetRecordType(client.UsageRecordType) error

	// generic getters/setters for external packages
	GetString(string) string
	Get(string) *Value
	SetString(key, val, index string) error

	GetExternal(string) ([]byte, error)
	SetExternal(string, []byte) error

	ClearValueAndIndex(string, string) error
}

type RefOption

type RefOption interface{}

func WithCreationTime

func WithCreationTime(tm time.Time) RefOption

func WithDescription

func WithDescription(descr string) RefOption

func WithImageRef

func WithImageRef(imageRef string) RefOption

WithImageRef appends the given imageRef to the cache ref's metadata

func WithRecordType

func WithRecordType(t client.UsageRecordType) RefOption

type SnapshotContentRow

type SnapshotContentRow struct {
	SnapshotID string
	Digest     digest.Digest
}

type SnapshotManager

type SnapshotManager interface {
	Accessor
	SnapshotSize(ctx context.Context, snapshotID string) (int64, error)
	SnapshotRecordMetadata(ctx context.Context, snapshotID string) (SnapshotRecordMetadata, bool, error)
	AttachLease(ctx context.Context, leaseID, snapshotID string) error
	RemoveLease(ctx context.Context, leaseID string) error
	LoadPersistentMetadata(rows PersistentMetadataRows) error
	PersistentMetadataRows() PersistentMetadataRows
	DeleteStaleDaggerOwnerLeases(ctx context.Context, keep map[string]struct{}) error
	Close() error
}

func NewSnapshotManager

func NewSnapshotManager(opt SnapshotManagerOpt) (SnapshotManager, error)

type SnapshotManagerOpt

type SnapshotManagerOpt struct {
	Snapshotter   Snapshotter
	ContentStore  content.Store
	LeaseManager  leases.Manager
	Applier       diff.Applier
	Differ        diff.Comparer
	MountPoolRoot string
}

type SnapshotRecordMetadata

type SnapshotRecordMetadata struct {
	RecordType  client.UsageRecordType
	Description string
}

type Snapshotter

type Snapshotter interface {
	Name() string
	Mounts(ctx context.Context, key string) (MountableRef, error)
	Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) error
	View(ctx context.Context, key, parent string, opts ...snapshots.Opt) (MountableRef, error)

	Stat(ctx context.Context, key string) (snapshots.Info, error)
	Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error)
	Usage(ctx context.Context, key string) (snapshots.Usage, error)
	Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error
	Remove(ctx context.Context, key string) error
	Walk(ctx context.Context, fn snapshots.WalkFunc, filters ...string) error
	Close() error
}

type Value

type Value struct {
	Value json.RawMessage `json:"value,omitempty"`
	Index string          `json:"index,omitempty"`
}

func NewValue

func NewValue(v interface{}) (*Value, error)

func (*Value) Unmarshal

func (v *Value) Unmarshal(target interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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