fs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 43 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoReferrers = errors.New("no existing referrers")
)

Functions

func FetchSociArtifacts

func FetchSociArtifacts(ctx context.Context, refspec reference.Spec, indexDesc ocispec.Descriptor, localStore store.Store, remoteStore resolverStorage) (*soci.Index, error)

func NewFilesystem

func NewFilesystem(ctx context.Context, root string, cfg config.FSConfig, opts ...Option) (_ snapshot.FileSystem, err error)

func SelectFirstPolicy

func SelectFirstPolicy(descs []ocispec.Descriptor) (ocispec.Descriptor, error)

Types

type Archive

type Archive interface {
	// Apply decompresses the compressed stream represented by reader `r` and
	// applies it to the directory `root`.
	Apply(ctx context.Context, root string, r io.Reader, opts ...archive.ApplyOpt) (int64, error)
}

func NewLayerArchive

func NewLayerArchive() Archive

type Fetcher

type Fetcher interface {
	// Fetch fetches the artifact identified by the descriptor. It first checks the local content store
	// and returns a `ReadCloser` from there. Otherwise it fetches from the remote, saves in the local content store
	// and then returns a `ReadCloser`.
	Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, bool, error)
	// Store takes in a descriptor and io.Reader and stores it in the local store.
	Store(ctx context.Context, desc ocispec.Descriptor, reader io.Reader) error
}

type IndexSelectionPolicy

type IndexSelectionPolicy func([]ocispec.Descriptor) (ocispec.Descriptor, error)

Determines which index will be selected from a list of index descriptors

type Inner

type Inner interface {
	content.Storage
	ReferrersCaller
}

type OCIArtifactClient

type OCIArtifactClient struct {
	Inner
}

func NewOCIArtifactClient

func NewOCIArtifactClient(inner Inner) *OCIArtifactClient

func (*OCIArtifactClient) AllReferrers

func (c *OCIArtifactClient) AllReferrers(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error)

func (*OCIArtifactClient) SelectReferrer

type Option

type Option func(*options)

func WithGetSources

func WithGetSources(s source.GetSources) Option

func WithMaxConcurrency added in v0.6.0

func WithMaxConcurrency(maxConcurrency int64) Option

func WithMetadataStore

func WithMetadataStore(metadataStore metadata.Store) Option

func WithOverlayOpaqueType

func WithOverlayOpaqueType(overlayOpaqueType layer.OverlayOpaqueType) Option

func WithResolveHandler

func WithResolveHandler(name string, handler remote.Handler) Option

type ReferrersCaller

type ReferrersCaller interface {
	Referrers(ctx context.Context, desc ocispec.Descriptor, artifactType string, fn func(referrers []ocispec.Descriptor) error) error
}

Interface for oras-go's Repository.Referrers call, for mocking

type ReferrersClient

type ReferrersClient interface {
	/// Takes in an manifest descriptor and IndexSelectionPolicy and returns a single artifact descriptor.
	/// Returns an error (ErrNoReferrers) if the manifest descriptor has no referrers.
	SelectReferrer(context.Context, ocispec.Descriptor, IndexSelectionPolicy) (ocispec.Descriptor, error)
}

Responsible for making Referrers API calls to remote registry to fetch list of referrers.

type Unpacker

type Unpacker interface {
	// Unpack takes care of getting the layer specified by descriptor `desc`,
	// decompressing it, putting it in the directory with the path `mountpoint`
	// and applying the difference to the parent layers if there is any.
	// After that the layer can be mounted as non-remote snapshot.
	Unpack(ctx context.Context, desc ocispec.Descriptor, mountpoint string, mounts []mount.Mount) error
}

func NewLayerUnpacker

func NewLayerUnpacker(fetcher Fetcher, archive Archive) Unpacker

Directories

Path Synopsis
metrics

Jump to

Keyboard shortcuts

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