ociartifact

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// Data is the actual artifact content.
	Data []byte

	// Path is the file representation of the artifact on disk. Can be empty if
	// the cache is not used.
	Path string
}

Artifact can be used to manage OCI artifacts.

type Impl

type Impl interface {
	ParseNormalizedNamed(string) (reference.Named, error)
	NewReference(reference.Named) (types.ImageReference, error)
	NewImageSource(context.Context, types.ImageReference, *types.SystemContext) (types.ImageSource, error)
	GetManifest(context.Context, types.ImageSource, *digest.Digest) ([]byte, string, error)
	ManifestFromBlob([]byte, string) (manifest.Manifest, error)
	ManifestConfigInfo(manifest.Manifest) types.BlobInfo
	LayerInfos(manifest.Manifest) []manifest.LayerInfo
	GetBlob(context.Context, types.ImageSource, types.BlobInfo, types.BlobInfoCache) (io.ReadCloser, int64, error)
	ReadAll(io.Reader) ([]byte, error)
	MkdirAll(string, os.FileMode) error
	ReadDir(string) ([]os.DirEntry, error)
	ReadFile(string) ([]byte, error)
	RemoveAll(string) error
	WriteFile(string, []byte, os.FileMode) error
}

type OCIArtifact

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

OCIArtifact is the main structure of this package.

func New

func New() *OCIArtifact

New returns a new OCI artifact implementation.

func (*OCIArtifact) Pull

func (o *OCIArtifact) Pull(ctx context.Context, img string, opts *PullOptions) (*Artifact, error)

Pull downloads the artifact content by using the provided image name and the specified options.

type PullOptions

type PullOptions struct {
	// SystemContext is the context used for pull.
	SystemContext *types.SystemContext

	// CachePath is the path to the used artifact cache. The cache can be
	// disabled if the value is an empty string.
	CachePath string

	// CacheEntryMaxAge is the maximum age cache entries can have before
	// getting removed.
	//
	// Defaults to 3 days.
	// Can be set to a negative value for disabling the removal.
	//
	// Note: Items only get removed on calling Pull(), which means they can be
	// technically older on disk.
	CacheEntryMaxAge time.Duration

	// EnforceConfigMediaType can be set to enforce a specific manifest config media type.
	EnforceConfigMediaType string

	// MaxSize is the maximum size of the artifact to be allowed to get pulled.
	// Will be set to a default of 1MiB if not specified (zero) or below zero.
	MaxSize int
}

PullOptions can be used to customize the pull behavior.

Jump to

Keyboard shortcuts

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