oci

package
v1.39.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemeHTTP  = "http"
	SchemeHTTPS = "https"
	SchemeFlipt = "flipt"
)
View Source
const (
	// MediaTypeFliptFeatures is the OCI media type for a flipt features artifact
	MediaTypeFliptFeatures = "application/vnd.io.flipt.features.v1"
	// MediaTypeFliptNamespace is the OCI media type for a flipt features namespace artifact
	MediaTypeFliptNamespace = "application/vnd.io.flipt.features.namespace.v1"

	// AnnotationFliptNamespace is an OCI annotation key which identifies the namespace key
	// of the annotated flipt namespace artifact
	AnnotationFliptNamespace = "io.flipt.features.namespace"
)

Variables

View Source
var (
	// ErrMissingMediaType is returned when a descriptor is presented
	// without a media type
	ErrMissingMediaType = errors.New("missing media type")
	// ErrUnexpectedMediaType is returned when an unexpected media type
	// is found on a target manifest or descriptor
	ErrUnexpectedMediaType = errors.New("unexpected media type")
	// ErrReferenceRequired is returned when a referenced is required for
	// a particular operation
	ErrReferenceRequired = errors.New("reference required")
)

Functions

func IfNoMatch

func IfNoMatch(digest digest.Digest) containers.Option[FetchOptions]

IfNoMatch configures the call to Fetch to return early if the supplied digest matches the target manifest pointed at by the underlying reference This is a cache optimization to skip re-fetching resources if the contents has already been seen by the caller

func WithCredentials

func WithCredentials(user, pass string) containers.Option[StoreOptions]

WithCredentials configures username and password credentials used for authenticating with remote registries

func WithManifestVersion added in v1.39.1

func WithManifestVersion(version oras.PackManifestVersion) containers.Option[StoreOptions]

WithManifestVersion configures what OCI Manifest version to build the bundle.

Types

type Bundle

type Bundle struct {
	Digest     digest.Digest
	Repository string
	Tag        string
	CreatedAt  time.Time
}

Bundle is a record of an existing Flipt feature bundle

type FetchOptions

type FetchOptions struct {
	IfNoMatch digest.Digest
}

FetchOptions configures a call to Fetch

type FetchResponse

type FetchResponse struct {
	Digest  digest.Digest
	Files   []fs.File
	Matched bool
}

FetchResponse contains any fetched files for the given tracked reference If Matched == true, then the supplied IfNoMatch digest matched and Files should be nil

type File

type File struct {
	io.ReadCloser
	// contains filtered or unexported fields
}

File is a wrapper around a flipt feature state files contents.

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek attempts to seek the embedded read-closer. If the embedded read closer implements seek, then it delegates to that instances implementation. Alternatively, it returns an error signifying that the File cannot be seeked.

func (*File) Stat

func (f *File) Stat() (fs.FileInfo, error)

type FileInfo

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

FileInfo describes a flipt features state file instance.

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) Sys

func (f FileInfo) Sys() any

type Reference

type Reference struct {
	registry.Reference
	Scheme string
}

func ParseReference

func ParseReference(repository string) (Reference, error)

type Store

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

Store is a type which can retrieve Flipt feature files from a target repository and reference Repositories can be local (OCI layout directories on the filesystem) or a remote registry

func NewStore

func NewStore(logger *zap.Logger, dir string, opts ...containers.Option[StoreOptions]) (*Store, error)

NewStore constructs and configures an instance of *Store for the provided config

func (*Store) Build

func (s *Store) Build(ctx context.Context, src fs.FS, ref Reference) (Bundle, error)

Build bundles the target directory Flipt feature state into the target configured on the Store It returns a Bundle which contains metadata regarding the resulting bundle details

func (*Store) Copy

func (s *Store) Copy(ctx context.Context, src, dst Reference) (Bundle, error)

func (*Store) Fetch

func (s *Store) Fetch(ctx context.Context, ref Reference, opts ...containers.Option[FetchOptions]) (*FetchResponse, error)

Fetch retrieves the associated files for the tracked repository and reference It can optionally be configured to skip fetching given the caller has a digest that matches the current reference target

func (*Store) List

func (s *Store) List(ctx context.Context) (bundles []Bundle, _ error)

List returns a slice of bundles available on the host

type StoreOptions

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

StoreOptions are used to configure call to NewStore This shouldn't be handled directory, instead use one of the function options e.g. WithBundleDir or WithCredentials

Jump to

Keyboard shortcuts

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