embedded

package
v0.411.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImageNotCached = errors.New("embedded image is not cached locally")

ErrImageNotCached is returned when an image is not present in the local store.

Functions

func ResolveCacheDir

func ResolveCacheDir(cacheDir string) (string, error)

ResolveCacheDir expands the configured cache dir or returns the default cache.

func Unpack

func Unpack(ctx context.Context, img v1.Image, destDir string) error

Unpack extracts img into destDir. mutate.Extract emits a flattened tar stream, so OCI whiteouts are already resolved before the archive is written to disk.

Types

type ImageRef

type ImageRef struct {
	Registry   string
	Repository string
	Tag        string
	Digest     string
}

ImageRef identifies an OCI image by registry, repository, and tag or digest.

func ParseImageRef

func ParseImageRef(raw string) (ImageRef, error)

ParseImageRef normalizes a Docker/OCI image reference into structured fields.

func (ImageRef) String

func (r ImageRef) String() string

type ImageStore

type ImageStore struct {
	Root string
}

ImageStore persists cached images using the OCI image layout spec.

func (*ImageStore) Delete

func (s *ImageStore) Delete(ref string) error

Delete removes a cached image reference from the local store.

func (*ImageStore) Get

func (s *ImageStore) Get(ref string) (v1.Image, error)

Get returns a cached image by its normalized reference.

func (*ImageStore) List

func (s *ImageStore) List() ([]StoreEntry, error)

List returns all cached image entries sorted by most recent access.

func (*ImageStore) Put

func (s *ImageStore) Put(ref string, img v1.Image) error

Put stores img as a single-image OCI layout keyed by ref.

func (*ImageStore) TotalSize

func (s *ImageStore) TotalSize() (int64, error)

TotalSize returns the total on-disk size of all cached images.

type RegistryClient

type RegistryClient struct {
	CacheDir string
	Auth     authn.Keychain
}

RegistryClient pulls OCI images into the local OCI layout cache.

func (*RegistryClient) GC

func (r *RegistryClient) GC(ctx context.Context, keepN int) error

GC removes cached images outside the most recently used keepN entries.

func (*RegistryClient) IsLocal

func (r *RegistryClient) IsLocal(ref ImageRef) (bool, error)

IsLocal reports whether ref already exists in the local OCI cache.

func (*RegistryClient) Pull

func (r *RegistryClient) Pull(ctx context.Context, ref ImageRef) (v1.Image, error)

Pull downloads ref from the registry and persists it into the local OCI cache.

type StoreEntry

type StoreEntry struct {
	Ref        string    `json:"ref"`
	Digest     string    `json:"digest,omitempty"`
	Size       int64     `json:"size"`
	Path       string    `json:"path"`
	StoredAt   time.Time `json:"storedAt,omitempty"`
	AccessedAt time.Time `json:"accessedAt,omitempty"`
}

StoreEntry describes one cached OCI image.

Jump to

Keyboard shortcuts

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