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 ReleaseTransferLeasesAfterRestart(ctx context.Context, lm leases.Manager) error
- 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 ChainContentError
- 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 BuiltinImageLeaseLabel = "dagger.io/builtin-image"
BuiltinImageLeaseLabel marks the persistent leases that hold the engine's builtin images' blobs; the startup sweeps leave them alone.
const BuiltinLayersLeaseID = "dagger/builtin-image/layers"
BuiltinLayersLeaseID is the persistent lease holding the blobs a chain import copied from the builtin image store: builtin blobs, so engine lifetime like the rest of the builtin images' content.
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 ¶ added in v0.21.9
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 ¶ added in v0.21.9
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 ¶ added in v0.21.9
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 ReleaseTransferLeasesAfterRestart ¶
ReleaseTransferLeasesAfterRestart must run only at startup, after durable snapshot owners have been restored and before any transfers can start. Retained typed refs are not released at clean shutdown. Their Go ownership ends with that process, so only durable owners should survive its transfers.
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)
ImportChain(ctx context.Context, chain *ExportChain) (ImmutableRef, error)
ApplySnapshotDiff(ctx context.Context, lower, upper ImmutableRef, opts ...RefOption) (ImmutableRef, error)
Merge(ctx context.Context, parents []ImmutableRef, opts ...RefOption) (ImmutableRef, error)
}
type ChainContentError ¶
ChainContentError identifies an unusable supplied chain. Storage/lease and receiver failures are deliberately not annotated with this type.
func (*ChainContentError) Error ¶
func (e *ChainContentError) Error() string
func (*ChainContentError) Unwrap ¶
func (e *ChainContentError) Unwrap() error
type ExportChain ¶
type ExportChain struct {
Layers []ExportLayer
Provider content.InfoReaderProvider
// contains filtered or unexported fields
}
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
}
func (*ImportedImage) Blobs ¶
func (img *ImportedImage) Blobs() []ocispecs.Descriptor
Blobs lists every blob of the image: manifest, config, layers and the non-layer descriptors.
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 ¶ added in v0.21.9
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 ¶ added in v0.21.9
func (*ProgressTracker) Finish ¶ added in v0.21.9
func (pt *ProgressTracker) Finish()
Finish emits the final state: the last recorded amount, against the known total if there is one.
func (*ProgressTracker) Update ¶ added in v0.21.9
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
PinSnapshot(context.Context, string) (ImmutableRef, error)
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
PinContent(ctx context.Context, leaseID string, descs []ocispecs.Descriptor) 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
// BuiltinContent is the engine's builtin image store, consulted by
// chain imports for a layer blob before the chain's provider. Nil means
// no such store.
BuiltinContent content.InfoReaderProvider
}
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
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package testutil builds real local snapshot and content stores for transfer tests.
|
Package testutil builds real local snapshot and content stores for transfer tests. |