ocicache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocicache reads OCI images from hypeman's shared OCI blob cache.

The cache is a content-addressable blob store under <data-dir>/system/oci-cache (see lib/paths). Images pushed to the embedded registry or pulled from remote registries are stored there as manifest, config, and layer blobs. This package reconstructs a go-containerregistry v1.Image from those blobs so callers can inspect or re-push cached images without a daemon.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDigest = errors.New("invalid image digest")

ErrInvalidDigest means a digest is not a well-formed sha256 hex string and cannot be used as a cache path component.

View Source
var ErrNotFound = errors.New("image not found in OCI cache")

ErrNotFound means no manifest blob exists in the cache for the requested digest.

Functions

func AppendImage

func AppendImage(cacheDir string, img v1.Image, tag string) error

AppendImage writes img's blobs into the OCI layout at cacheDir, then appends a descriptor tagged with org.opencontainers.image.ref.name=tag to index.json.

Every file is written to a temp file and renamed into place, so readers never see a partial blob or index and an interrupted write never replaces a good file. Blob writes run concurrently; the index update is serialized.

func ImageFromCache

func ImageFromCache(p *paths.Paths, digest string) (v1.Image, error)

ImageFromCache creates a v1.Image that reads from the OCI blob cache. Docker v2 manifests are transparently converted to OCI format, matching the conversion applied when images are appended to the OCI layout. Returns ErrInvalidDigest for a malformed digest and ErrNotFound when the manifest blob is not in the cache.

func WriteBlob

func WriteBlob(cacheDir string, hash v1.Hash, data []byte) error

WriteBlob stores data as the blob for hash, which the caller must have verified. Atomic and concurrency-safe like the blobs AppendImage writes.

Types

This section is empty.

Directories

Path Synopsis
Package testutil provides helpers for tests that write images into hypeman's OCI blob cache, shared across packages.
Package testutil provides helpers for tests that write images into hypeman's OCI blob cache, shared across packages.

Jump to

Keyboard shortcuts

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