source

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigDirLabel = "operators.operatorframework.io.index.configs.v1"
View Source
const UnpackCacheDir = "unpack"

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageRegistry added in v0.8.0

type ImageRegistry struct {
	BaseCachePath string
	AuthNamespace string
}

func (*ImageRegistry) Cleanup added in v0.8.0

func (i *ImageRegistry) Cleanup(_ context.Context, catalog *catalogdv1alpha1.Catalog) error

func (*ImageRegistry) Unpack added in v0.8.0

func (i *ImageRegistry) Unpack(ctx context.Context, catalog *catalogdv1alpha1.Catalog) (*Result, error)

type Result

type Result struct {
	// Bundle contains the full filesystem of a catalog's root directory.
	FS fs.FS

	// ResolvedSource is a reproducible view of a Bundle's Source.
	// When possible, source implementations should return a ResolvedSource
	// that pins the Source such that future fetches of the catalog content can
	// be guaranteed to fetch the exact same catalog content as the original
	// unpack.
	//
	// For example, resolved image sources should reference a container image
	// digest rather than an image tag, and git sources should reference a
	// commit hash rather than a branch or tag.
	ResolvedSource *catalogdv1alpha1.ResolvedCatalogSource

	// State is the current state of unpacking the catalog content.
	State State

	// Message is contextual information about the progress of unpacking the
	// catalog content.
	Message string
}

Result conveys progress information about unpacking catalog content.

type State

type State string
const (
	// StatePending conveys that a request for unpacking a catalog has been
	// acknowledged, but not yet started.
	StatePending State = "Pending"

	// StateUnpacking conveys that the source is currently unpacking a catalog.
	// This state should be used when the catalog contents are being downloaded
	// and processed.
	StateUnpacking State = "Unpacking"

	// StateUnpacked conveys that the catalog has been successfully unpacked.
	StateUnpacked State = "Unpacked"
)

type Unpacker

type Unpacker interface {
	Unpack(context.Context, *catalogdv1alpha1.Catalog) (*Result, error)
	Cleanup(context.Context, *catalogdv1alpha1.Catalog) error
}

Unpacker unpacks catalog content, either synchronously or asynchronously and returns a Result, which conveys information about the progress of unpacking the catalog content.

If a Source unpacks content asynchronously, it should register one or more watches with a controller to ensure that Bundles referencing this source can be reconciled as progress updates are available.

For asynchronous Sources, multiple calls to Unpack should be made until the returned result includes state StateUnpacked.

NOTE: A source is meant to be agnostic to specific catalog formats and specifications. A source should treat a catalog root directory as an opaque file tree and delegate catalog format concerns to catalog parsers.

func NewDefaultUnpacker

func NewDefaultUnpacker(namespace, cacheDir string) (Unpacker, error)

NewDefaultUnpacker returns a new composite Source that unpacks catalogs using a default source mapping with built-in implementations of all of the supported source types.

TODO: refactor NewDefaultUnpacker due to growing parameter list

func NewUnpacker

func NewUnpacker(sources map[catalogdv1alpha1.SourceType]Unpacker) Unpacker

NewUnpacker returns a new composite Source that unpacks catalogs using the source mapping provided by the configured sources.

Jump to

Keyboard shortcuts

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