layer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 41 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

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

FuseOpsList is a list of available FUSE operations.

Functions

func TestSuiteLayer

func TestSuiteLayer(t *testing.T, store metadata.Store)

Types

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) (fusefs.InodeEmbedder, error)

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

	// Refresh refreshes the layer connection.
	Refresh(ctx context.Context, hosts source.RegistryHosts, refspec reference.Spec, desc ocispec.Descriptor) error

	// Verify verifies this layer using the passed TOC Digest.
	// Nop if Verify() or SkipVerify() was already called.
	Verify(tocDigest digest.Digest) (err error)

	// SkipVerify skips verification for this layer.
	// Nop if Verify() or SkipVerify() was already called.
	SkipVerify()

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

	// 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()
}

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.Config, 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) Resolve

func (r *Resolver) Resolve(ctx context.Context, hosts source.RegistryHosts, refspec reference.Spec, desc, sociDesc ocispec.Descriptor, opCounter *FuseOperationCounter, metadataOpts ...metadata.Option) (_ Layer, retErr error)

Resolve resolves a layer based on the passed layer blob information.

Jump to

Keyboard shortcuts

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