cache

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 60 Imported by: 963

Documentation

Index

Constants

View Source
const (
	BaseLayer refKind = iota
	Layer
	Merge
	Diff
)

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 CachePolicyDefault added in v0.6.0

func CachePolicyDefault(m *cacheMetadata) error

func CachePolicyRetain

func CachePolicyRetain(m *cacheMetadata) error

func IsNotFound

func IsNotFound(err error) bool

func MigrateV2 added in v0.7.0

func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapshot.Snapshotter, lm leases.Manager) error

Types

type Accessor

type Accessor interface {
	MetadataStore

	GetByBlob(ctx context.Context, desc ocispecs.Descriptor, parent ImmutableRef, opts ...RefOption) (ImmutableRef, error)
	Get(ctx context.Context, id string, pg progress.Controller, opts ...RefOption) (ImmutableRef, error)

	New(ctx context.Context, parent ImmutableRef, s session.Group, opts ...RefOption) (MutableRef, error)
	GetMutable(ctx context.Context, id string, opts ...RefOption) (MutableRef, error) // Rebase?
	IdentityMapping() *idtools.IdentityMapping
	Merge(ctx context.Context, parents []ImmutableRef, pg progress.Controller, opts ...RefOption) (ImmutableRef, error)
	Diff(ctx context.Context, lower, upper ImmutableRef, pg progress.Controller, opts ...RefOption) (ImmutableRef, error)
}

type Controller

type Controller interface {
	DiskUsage(ctx context.Context, info client.DiskUsageInfo) ([]*client.UsageInfo, error)
	Prune(ctx context.Context, ch chan client.UsageInfo, info ...client.PruneInfo) error
}

type DescHandler added in v0.8.0

type DescHandler struct {
	Provider       func(session.Group) content.Provider
	Progress       progress.Controller
	SnapshotLabels map[string]string
	Annotations    map[string]string
	Ref            string // string representation of desc origin, can be used as a sync key
}

type DescHandlerKey added in v0.8.0

type DescHandlerKey digest.Digest

type DescHandlers added in v0.8.0

type DescHandlers map[digest.Digest]*DescHandler

type ExternalRefChecker

type ExternalRefChecker interface {
	Exists(string, []digest.Digest) bool
}

type ExternalRefCheckerFunc

type ExternalRefCheckerFunc func() (ExternalRefChecker, error)

type ImmutableRef

type ImmutableRef interface {
	Ref
	Clone() ImmutableRef
	// Finalize commits the snapshot to the driver if it's not already.
	// This means the snapshot can no longer be mounted as mutable.
	Finalize(context.Context) error

	Extract(ctx context.Context, s session.Group) error // +progress
	GetRemotes(ctx context.Context, createIfNeeded bool, cfg config.RefConfig, all bool, s session.Group) ([]*solver.Remote, error)
	LayerChain() RefList
	FileList(ctx context.Context, s session.Group) ([]string, error)
}

type Manager

type Manager interface {
	Accessor
	Controller
	Close() error
}

func NewManager

func NewManager(opt ManagerOpt) (Manager, error)

type ManagerOpt

type ManagerOpt struct {
	Snapshotter     snapshot.Snapshotter
	ContentStore    content.Store
	LeaseManager    leases.Manager
	PruneRefChecker ExternalRefCheckerFunc
	GarbageCollect  func(ctx context.Context) (gc.Stats, error)
	Applier         diff.Applier
	Differ          diff.Comparer
	MetadataStore   *metadata.Store
	Root            string
	MountPoolRoot   string
}

type MetadataStore added in v0.10.0

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

type Mountable

type Mountable interface {
	Mount(ctx context.Context, readonly bool, s session.Group) (snapshot.Mountable, error)
}

type MutableRef

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

type NeedsRemoteProviderError added in v0.10.0

type NeedsRemoteProviderError []digest.Digest //nolint:errname

func (NeedsRemoteProviderError) Error added in v0.10.0

func (m NeedsRemoteProviderError) Error() string

type Ref

type Ref interface {
	Mountable
	RefMetadata
	Release(context.Context) error
	IdentityMapping() *idtools.IdentityMapping
	DescHandler(digest.Digest) *DescHandler
}

Ref is a reference to cacheable objects.

type RefList added in v0.10.0

type RefList []ImmutableRef

func (RefList) Release added in v0.10.0

func (l RefList) Release(ctx context.Context) (rerr error)

type RefMetadata added in v0.10.0

type RefMetadata interface {
	ID() string

	GetDescription() string
	SetDescription(string) error

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

	HasCachePolicyDefault() bool
	SetCachePolicyDefault() error
	HasCachePolicyRetain() bool
	SetCachePolicyRetain() error

	GetLayerType() string
	SetLayerType(string) error

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

	GetEqualMutable() (RefMetadata, bool)

	// generic getters/setters for external packages
	GetString(string) string
	Get(string) *metadata.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 added in v0.8.0

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 Unlazier added in v0.8.0

type Unlazier interface {
	Unlazy(ctx context.Context) error
}

type Unlazy added in v0.11.2

type Unlazy session.Group

Directories

Path Synopsis
gha
s3
v1

Jump to

Keyboard shortcuts

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