worker

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 18 Imported by: 379

Documentation

Index

Constants

View Source
const (
	LabelExecutor            = labelPrefix + "executor"    // "oci" or "containerd"
	LabelSnapshotter         = labelPrefix + "snapshotter" // containerd snapshotter name ("overlay", "native", ...)
	LabelHostname            = labelPrefix + "hostname"
	LabelNetwork             = labelPrefix + "network" // "cni" or "host"
	LabelApparmorProfile     = labelPrefix + "apparmor.profile"
	LabelOCIProcessMode      = labelPrefix + "oci.process-mode"     // OCI worker: process mode ("sandbox", "no-sandbox")
	LabelContainerdUUID      = labelPrefix + "containerd.uuid"      // containerd worker: containerd UUID
	LabelContainerdNamespace = labelPrefix + "containerd.namespace" // containerd worker: containerd namespace
)

Pre-defined label keys

Variables

This section is empty.

Functions

func NewCacheResultStorage

func NewCacheResultStorage(wc *Controller) solver.CacheResultStorage

func NewWorkerRefResult

func NewWorkerRefResult(ref cache.ImmutableRef, worker Worker) solver.Result

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller holds worker instances. Currently, only local workers are supported.

func (*Controller) Add

func (c *Controller) Add(w Worker) error

Add adds a local worker. The first worker becomes the default.

Add is not thread-safe.

func (*Controller) Get

func (c *Controller) Get(id string) (Worker, error)

func (*Controller) GetDefault

func (c *Controller) GetDefault() (Worker, error)

GetDefault returns the default local worker

func (*Controller) List

func (c *Controller) List(filterStrings ...string) ([]Worker, error)

List lists workers

func (*Controller) WorkerInfos

func (c *Controller) WorkerInfos() []client.WorkerInfo

WorkerInfos returns slice of WorkerInfo. The first item is the default worker.

type Infos added in v0.8.0

type Infos interface {
	GetDefault() (Worker, error)
	WorkerInfos() []client.WorkerInfo
}

type Worker

type Worker interface {
	// ID needs to be unique in the cluster
	ID() string
	Labels() map[string]string
	Platforms(noCache bool) []ocispecs.Platform

	GCPolicy() []client.PruneInfo
	LoadRef(ctx context.Context, id string, hidden bool) (cache.ImmutableRef, error)
	// ResolveOp resolves Vertex.Sys() to Op implementation.
	ResolveOp(v solver.Vertex, s frontend.FrontendLLBBridge, sm *session.Manager) (solver.Op, error)
	ResolveImageConfig(ctx context.Context, ref string, opt llb.ResolveImageConfigOpt, sm *session.Manager, g session.Group) (digest.Digest, []byte, error)
	DiskUsage(ctx context.Context, opt client.DiskUsageInfo) ([]*client.UsageInfo, error)
	Exporter(name string, sm *session.Manager) (exporter.Exporter, error)
	Prune(ctx context.Context, ch chan client.UsageInfo, opt ...client.PruneInfo) error
	FromRemote(ctx context.Context, remote *solver.Remote) (cache.ImmutableRef, error)
	PruneCacheMounts(ctx context.Context, ids []string) error
	ContentStore() content.Store
	Executor() executor.Executor
	CacheManager() cache.Manager
}

type WorkerRef

type WorkerRef struct {
	ImmutableRef cache.ImmutableRef
	Worker       Worker
}

func (*WorkerRef) GetRemotes added in v0.10.0

func (wr *WorkerRef) GetRemotes(ctx context.Context, createIfNeeded bool, refCfg cacheconfig.RefConfig, all bool, g session.Group) ([]*solver.Remote, error)

GetRemotes method abstracts ImmutableRef's GetRemotes to allow a Worker to override. This is needed for moby integration. Use this method instead of calling ImmutableRef.GetRemotes() directly.

func (*WorkerRef) ID

func (wr *WorkerRef) ID() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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