worker

package
v23.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Apache-2.0 Imports: 44 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultGCPolicy

func DefaultGCPolicy(p string, defaultKeepBytes int64) []client.PruneInfo

DefaultGCPolicy returns a default builder GC policy

Types

type LayerAccess

type LayerAccess interface {
	GetDiffIDs(ctx context.Context, key string) ([]layer.DiffID, error)
	EnsureLayer(ctx context.Context, key string) ([]layer.DiffID, error)
}

LayerAccess provides access to a moby layer from a snapshot

type Opt

type Opt struct {
	ID                string
	Labels            map[string]string
	GCPolicy          []client.PruneInfo
	Executor          executor.Executor
	Snapshotter       snapshot.Snapshotter
	ContentStore      content.Store
	CacheManager      cache.Manager
	ImageSource       *containerimage.Source
	DownloadManager   *xfer.LayerDownloadManager
	V2MetadataService distmetadata.V2MetadataService
	Transport         nethttp.RoundTripper
	Exporter          exporter.Exporter
	Layers            LayerAccess
	Platforms         []ocispec.Platform
}

Opt defines a structure for creating a worker.

type Worker

type Worker struct {
	Opt
	SourceManager *source.Manager
}

Worker is a local worker instance with dedicated snapshotter, cache, and so on. TODO: s/Worker/OpWorker/g ?

func NewWorker

func NewWorker(opt Opt) (*Worker, error)

NewWorker instantiates a local worker

func (*Worker) CacheManager

func (w *Worker) CacheManager() cache.Manager

CacheManager returns cache.Manager for accessing local storage

func (*Worker) ContentStore

func (w *Worker) ContentStore() content.Store

ContentStore returns content store

func (*Worker) DiskUsage

func (w *Worker) DiskUsage(ctx context.Context, opt client.DiskUsageInfo) ([]*client.UsageInfo, error)

DiskUsage returns disk usage report

func (*Worker) Executor

func (w *Worker) Executor() executor.Executor

Executor returns executor.Executor for running processes

func (*Worker) Exporter

func (w *Worker) Exporter(name string, sm *session.Manager) (exporter.Exporter, error)

Exporter returns exporter by name

func (*Worker) FromRemote

func (w *Worker) FromRemote(ctx context.Context, remote *solver.Remote) (cache.ImmutableRef, error)

FromRemote converts a remote snapshot reference to a local one

func (*Worker) GCPolicy

func (w *Worker) GCPolicy() []client.PruneInfo

GCPolicy returns automatic GC Policy

func (*Worker) GetRemotes

func (w *Worker) GetRemotes(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool, _ cacheconfig.RefConfig, all bool, s session.