Documentation
¶
Index ¶
- Constants
- Variables
- func DisplayRef(ref string) string
- func EmitProgress(ctx context.Context, item string, current, total int64, unit string)
- func EnsureLease(ctx context.Context) (context.Context, error)
- func HasLazyLease(ctx context.Context) bool
- func IsNotFound(err error) bool
- func MakeTemporary(l *leases.Lease) error
- func NewProgressReader(ctx context.Context, item string, total int64, r io.ReadCloser) io.ReadCloser
- func WithLazyLease(ctx context.Context, lm leases.Manager, opts ...leases.Opt) (context.Context, func(context.Context) error, error)
- func WithLease(ctx context.Context, ls leases.Manager, opts ...leases.Opt) (context.Context, func(context.Context) error, error)
- func WithoutLazyLease(ctx context.Context) context.Context
- type Accessor
- type Diff
- type ExportChain
- type ExportLayer
- type ImmutableRef
- type ImportImageOpts
- type ImportedImage
- type ImportedLayerBlobKey
- type ImportedLayerBlobRow
- type ImportedLayerDiffKey
- type ImportedLayerDiffRow
- type LeaseManager
- func (l *LeaseManager) AddResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error
- func (l *LeaseManager) Create(ctx context.Context, opts ...leases.Opt) (leases.Lease, error)
- func (l *LeaseManager) Delete(ctx context.Context, lease leases.Lease, opts ...leases.DeleteOpt) error
- func (l *LeaseManager) DeleteResource(ctx context.Context, lease leases.Lease, resource leases.Resource) error
- func (l *LeaseManager) List(ctx context.Context, filters ...string) ([]leases.Lease, error)
- func (l *LeaseManager) ListResources(ctx context.Context, lease leases.Lease) ([]leases.Resource, error)
- func (l *LeaseManager) Namespace() string
- func (l *LeaseManager) WithNamespace(ns string) *LeaseManager
- type LeaseRef
- type LocalMounterOpt
- type MergeSnapshotter
- type MetadataStore
- type Mountable
- type MountableRef
- type Mounter
- type MutableRef
- type PersistentMetadataRows
- type ProgressTracker
- type Ref
- type RefMetadata
- type RefOption
- type SnapshotContentRow
- type SnapshotManager
- type SnapshotManagerOpt
- type SnapshotRecordMetadata
- type Snapshotter
- type Value
Constants ¶
const ProgressEmitInterval = 100 * time.Millisecond
ProgressEmitInterval throttles streaming progress records; the final record for an item is always emitted so consumers converge on the true completed state.
Variables ¶
var (
ErrLocked = errors.New("locked")
)
var ErrNoBlobs = errors.Errorf("no blobs for snapshot")
var NoUpdateLastUsed noUpdateLastUsed
Functions ¶
func DisplayRef ¶
DisplayRef shortens a fully qualified image ref for transfer span names ("pulling <ref>", "unpacking <ref>"): these surface as labeled progress rows in the TUI, where the repo digest and default registry are noise.
func EmitProgress ¶
EmitProgress sends one streaming-progress log record for the named item, attributed to the current span via ctx. The unit names what current/total count, e.g. "bytes" or "objects"; see engine/telemetryattrs for the conventions.
func HasLazyLease ¶
func IsNotFound ¶
func MakeTemporary ¶
func NewProgressReader ¶
func NewProgressReader(ctx context.Context, item string, total int64, r io.ReadCloser) io.ReadCloser
NewProgressReader wraps r to stream its read progress as one item via the telemetry convention, attributed to the span carried by ctx. A total <= 0 means the size is unknown (indeterminate). The final state is emitted when the reader sees EOF or is closed.
func WithLazyLease ¶
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)
Scratch(ctx context.Context) (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 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 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 ImportedLayerBlobRow ¶
type ImportedLayerDiffKey ¶
type ImportedLayerDiffRow ¶
type LeaseManager ¶
type LeaseManager struct {
// contains filtered or unexported fields
}
func NewLeaseManager ¶
func NewLeaseManager(lm leases.Manager, ns string) *LeaseManager
func (*LeaseManager) AddResource ¶
func (*LeaseManager) DeleteResource ¶
func (*LeaseManager) ListResources ¶
func (*LeaseManager) Namespace ¶
func (l *LeaseManager) Namespace() string
func (*LeaseManager) WithNamespace ¶
func (l *LeaseManager) WithNamespace(ns string) *LeaseManager
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 Mountable ¶
type Mountable interface {
Mount(ctx context.Context, readonly bool) (MountableRef, error)
}
type MountableRef ¶
type MountableRef = executor.MountableRef
type Mounter ¶
func LocalMounter ¶
func LocalMounter(mountable MountableRef, opts ...LocalMounterOpt) Mounter
func LocalMounterWithMounts ¶
func LocalMounterWithMounts(mounts []mount.Mount, opts ...LocalMounterOpt) Mounter
type MutableRef ¶
type PersistentMetadataRows ¶
type PersistentMetadataRows struct {
SnapshotContent []SnapshotContentRow
ImportedByBlob []ImportedLayerBlobRow
ImportedByDiff []ImportedLayerDiffRow
}
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker streams one item's absolute progress with throttled updates. A known total emits an initial zero state immediately so the item appears as soon as work begins; an unknown total (<= 0) stays silent until progress is actually made, so no-op transfers emit nothing.
func NewProgressTracker ¶
func (*ProgressTracker) Finish ¶
func (pt *ProgressTracker) Finish()
Finish emits the final state: the last recorded amount, against the known total if there is one.
func (*ProgressTracker) Update ¶
func (pt *ProgressTracker) Update(current int64)
Update records the item's absolute progress, emitting on a throttle; Finish guarantees the final state.
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 WithDescription ¶
func WithImageRef ¶
WithImageRef appends the given imageRef to the cache ref's metadata
func WithRecordType ¶
func WithRecordType(t client.UsageRecordType) RefOption
type SnapshotContentRow ¶
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 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
}