Help us shape the future of Go! Take the 2026 Go Developer Survey

layer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuseOpsList = []string{
	fuseOpGetattr,
	fuseOpGetxattr,
	fuseOpListxattr,
	fuseOpLookup,
	fuseOpOpen,
	fuseOpReaddir,
	fuseOpReadLink,
	fuseOpFileRead,
	fuseOpFileGetattr,
	fuseOpWhiteoutGetattr,
}

FuseOpsList is a list of available FUSE operations.

Functions

This section is empty.

Types

type BackgroundFetchMode

type BackgroundFetchMode string
const (
	BackgroundFetchEnabled  BackgroundFetchMode = "enabled"
	BackgroundFetchDisabled BackgroundFetchMode = "disabled"
)

type BackgroundFetchPolicy

type BackgroundFetchPolicy struct {
	Mode BackgroundFetchMode
}

type FuseOperationCounter

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

FuseOperationCounter collects number of invocations of the various FUSE implementations and emits them as metrics. Setting `waitPeriod` to be > 0 allows delaying the time when the metrics are emitted.

func NewFuseOperationCounter

func NewFuseOperationCounter(imgDigest digest.Digest, waitPeriod time.Duration) *FuseOperationCounter

NewFuseOperationCounter constructs a FuseOperationCounter for an image with digest imgDigest. waitPeriod specifies how long to wait before emitting the aggregated metrics.

func (*FuseOperationCounter) Inc

func (f *FuseOperationCounter) Inc(op string)

Inc atomically increase the count of FUSE operation op. Noop if op is not in FuseOpsList.

func (*FuseOperationCounter) Run

func (f *FuseOperationCounter) Run(ctx context.Context)

Run waits for f.waitPeriod to pass before emitting a log and metric for each operation in FuseOpsList. Should be started in different goroutine so that it doesn't block the current goroutine.

type Info

type Info struct {
	Digest      digest.Digest
	Size        int64     // layer size in bytes
	FetchedSize int64     // layer fetched size in bytes
	ReadTime    time.Time // last time the layer was read
}

Info is the current status of a layer.

type Layer

type Layer interface {
	// Info returns the information of this layer.
	Info() Info

	// RootNode returns the root node of this layer.
	RootNode(baseInode uint32, idMapper idtools.IDMap) (fusefs.InodeEmbedder, error)

	// Check checks if the layer is still connectable.
	Check() error

	// Refresh refreshes the layer connection.
	Refresh(ctx context.Context, hosts []docker.RegistryHost, refspec reference.Spec, desc ocispec.Descriptor) error

	// ReadAt reads this layer.
	ReadAt([]byte, int64, ...remote.Option) (int, error)

	// DisableXAttrs determines whether this layer should have xattrs disabled
	DisableXAttrs() bool

	// Done releases the reference to this layer. The resources related to this layer will be
	// discarded sooner or later. Queries after calling this function won't be serviced.
	Done()

	// GetCacheRefKey returns the reference key for the cache used by the layer
	GetCacheRefKey() string
}

Layer represents a layer.

type OverlayOpaqueType

type OverlayOpaqueType int

OverlayOpaqueType enum possible types.

const (
	OverlayOpaqueAll OverlayOpaqueType = iota
	OverlayOpaqueTrusted
	OverlayOpaqueUser
)

OverlayOpaqueType enum.

type Resolver

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

Resolver resolves the layer location and provieds the handler of that layer.

func NewResolver

func NewResolver(root string, cfg config.FSConfig, resolveHandlers map[string]remote.Handler,
	metadataStore metadata.Store, artifactStore content.Storage, overlayOpaqueType OverlayOpaqueType, bgFetcher *backgroundfetcher.BackgroundFetcher) (*Resolver, error)

NewResolver returns a new layer resolver.

func (*Resolver) Evict

func (r *Resolver) Evict(name string)

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, hosts []docker.RegistryHost, refspec reference.Spec, desc, sociDesc ocispec.Descriptor, opCounter *FuseOperationCounter, disableVerification bool, prefetchDesc *ocispec.Descriptor, bgPolicy BackgroundFetchPolicy, metadataOpts ...metadata.Option) (_ Layer, retErr error)

Resolve resolves a layer based on the passed layer blob information. prefetchDesc is optional - if provided, it will be used for prefetching spans

Jump to

Keyboard shortcuts

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