oci

package
v1.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 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

Index

Constants

This section is empty.

Variables

View Source
var ErrSourceDigestUnresolved = errors.New("source image digest cannot be resolved")

ErrSourceDigestUnresolved marks failures while resolving or inspecting the source digest, allowing delta preparation to skip only that device.

Functions

func BuildOciRepoRef

func BuildOciRepoRef(ctx context.Context, ociSpec *domain.OciRepoSpec, ref string) (*remote.Repository, error)

BuildOciRepoRef creates a fully configured ORAS remote.Repository from an OciRepoSpec and a full reference string (e.g. "registry.example.com/my-image"). It sets up TLS, credentials, and HTTP scheme based on the spec. Callers that push artifacts should also set repoRef.SkipReferrersGC = true.

func BuildOciTLSConfig

func BuildOciTLSConfig(ociSpec *domain.OciRepoSpec) (*tls.Config, error)

BuildOciTLSConfig builds a *tls.Config from an OciRepoSpec, applying InsecureSkipVerify and custom CA certificates as configured.

func CachedImageDigest added in v1.4.0

func CachedImageDigest(ctx context.Context, logger logrus.FieldLogger, cache DigestCache, orgID uuid.UUID, image string, cacheTTL time.Duration, resolve func(context.Context) (string, error)) (string, error)

func DeviceImagePlatform added in v1.4.0

func DeviceImagePlatform(device *domain.Device) *ocispec.Platform

DeviceImagePlatform returns the OS and architecture reported by a device. A missing status or incomplete platform is represented by nil so callers can use their existing single-manifest fallback behavior.

func DigestFromImageRef added in v1.4.0

func DigestFromImageRef(imageRef string) (string, error)

func ImageDestRef added in v1.4.0

func ImageDestRef(registry, imageName, imageTag string) string

func InspectImageDigest added in v1.4.0

func InspectImageDigest(ctx context.Context, image string, spec *domain.OciRepoSpec) (string, error)

func InspectImagePayloadSize added in v1.4.0

func InspectImagePayloadSize(ctx context.Context, imageRef, targetDigest string, spec *domain.OciRepoSpec, platform *ocispec.Platform) (*int64, error)

InspectImagePayloadSize returns the config and layer payload size for an OCI image. When targetDigest is set, it is used instead of resolving imageRef so a mutable tag cannot change between digest and size inspection.

func RegistryObjectRef added in v1.4.0

func RegistryObjectRef(spec *domain.OciRepoSpec, imageName string) (string, error)

func RemoteRepository added in v1.4.0

func RemoteRepository(ctx context.Context, spec *domain.OciRepoSpec, imageRef string) (*remote.Repository, string, error)

func RepoDestRef added in v1.4.0

func RepoDestRef(registry, imageName string) string

func ResolveDeltaPushPath added in v1.4.0

func ResolveDeltaPushPath(spec *domain.OciRepoSpec, imageRepository string) (string, error)

func RewriteImageRef added in v1.4.0

func RewriteImageRef(image string) (string, error)

func SpecForRegistry added in v1.4.0

func SpecForRegistry(host string, spec *domain.OciRepoSpec) *domain.OciRepoSpec

Types

type DigestCache added in v1.4.0

type DigestCache interface {
	Get(ctx context.Context, key string) ([]byte, error)
}

type ImageDigestPair added in v1.4.0

type ImageDigestPair struct {
	SourceDigest string `json:"sourceDigest"`
	TargetDigest string `json:"targetDigest"`
}

ImageDigestPair contains the platform-specific source and target manifests used for OCI delta generation.

func CachedImageDigestPair added in v1.4.0

func CachedImageDigestPair(
	ctx context.Context,
	logger logrus.FieldLogger,
	cache DigestCache,
	orgID uuid.UUID,
	imageRef string,
	sourceDigest string,
	fallbackPlatform *ocispec.Platform,
	cacheTTL time.Duration,
	resolveImageDigest func(context.Context) (string, error),
	resolvePair func(context.Context, string) (ImageDigestPair, error),
) (ImageDigestPair, error)

CachedImageDigestPair resolves mutable target references through the short-lived image digest cache, then caches the pair by immutable target digest. The tag lookup can be stale for at most cacheTTL. The pair cache key also includes the source digest and fallback platform because a multi-platform target can resolve to a different leaf digest for different source platforms.

func InspectImageDigestPair added in v1.4.0

func InspectImageDigestPair(
	ctx context.Context,
	imageRef string,
	sourceDigest string,
	spec *domain.OciRepoSpec,
	fallbackPlatform *ocispec.Platform,
) (ImageDigestPair, error)

InspectImageDigestPair resolves sourceDigest to its platform-specific image manifest, then resolves imageRef to a manifest for the same platform. If the source digest is an image index, fallbackPlatform identifies the instance selected by the device runtime.

Jump to

Keyboard shortcuts

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