cache

package
v0.0.0-...-2745715 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 58 Imported by: 0

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

func CachePolicyDefault(m *cacheMetadata) error

func CachePolicyRetain

func CachePolicyRetain(m *cacheMetadata) error

func IsNotFound

func IsNotFound(err error) bool

func MigrateV2

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

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

type DescHandlerKey digest.Digest

type DescHandlers

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
	MountPoolRoot   string
}

type MetadataStore

type MetadataStore interface {
	Search(context.Context, string) ([]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

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

func (NeedsRemoteProviderError) Error

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

type RefList []ImmutableRef

func (RefList) Release

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

type RefMetadata

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
	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 Unlazier

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

type Unlazy

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