layer

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 42 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestSuiteLayer added in v0.11.0

func TestSuiteLayer(t *TestRunner, store metadata.Store)

Types

type Info

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

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

	// Prefetch prefetches the specified size. If the layer is eStargz and contains landmark files,
	// the range indicated by these files is respected.
	Prefetch(prefetchSize int64) error

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

	// WaitForPrefetchCompletion waits untils Prefetch completes.
	WaitForPrefetchCompletion() error

	// BackgroundFetch fetches the entire layer contents to the cache.
	// Fetching contents is done as a background task.
	BackgroundFetch() 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()

	// Close is the same as Done. But this evicts the resources related to this Layer immediately.
	// This can be used for cleaning up resources on unmount.
	Close() error
}

Layer represents a layer.

type OverlayOpaqueType added in v0.11.3

type OverlayOpaqueType int
const (
	OverlayOpaqueAll OverlayOpaqueType = iota
	OverlayOpaqueTrusted
	OverlayOpaqueUser
)

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, backgroundTaskManager *task.BackgroundTaskManager, cfg config.Config, resolveHandlers map[string]remote.Handler, metadataStore metadata.Store, overlayOpaqueType OverlayOpaqueType, additionalDecompressors func(context.Context, source.RegistryHosts, reference.Spec, ocispec.Descriptor) []metadata.Decompressor) (*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 ocispec.Descriptor, esgzOpts ...metadata.Option) (_ Layer, retErr error)

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

type Runner added in v0.18.0

type Runner func(t TestingT, name string, fn func(t TestingT))

Runner allows running subtests of TestingT. This exists instead of adding a Run method to TestingT interface because the Run implementation of testing.T would not satisfy the interface.

type TestRunner added in v0.18.0

type TestRunner struct {
	TestingT
	Runner Runner
}

func (*TestRunner) Run added in v0.18.0

func (r *TestRunner) Run(name string, run func(*TestRunner))

type TestingT added in v0.18.0

type TestingT interface {
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Logf(format string, args ...any)
}

TestingT is the minimal set of testing.T required to run the tests defined in TestSuiteLayer. This interface exists to prevent leaking the testing package from being exposed outside tests.

Jump to

Keyboard shortcuts

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