imageio

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package imageio adapts containers-image transports for the diffah service layer. It hides the upstream API surface so service code can stay focused on the diff and reconstruction algorithms.

Index

Constants

View Source
const (
	FormatOCIArchive    = "oci-archive"
	FormatDockerArchive = "docker-archive"
)

Variables

This section is empty.

Functions

func BuildSystemContext added in v0.2.0

func BuildSystemContext(f SystemContextFlags) (*types.SystemContext, error)

BuildSystemContext validates the flag combination and constructs the upstream types.SystemContext.

On validation failure the returned error is a plain value (no classification). Callers in cmd/registry_flags.go wrap it in a cliErr with categoryUser.

func DefaultPolicyContext

func DefaultPolicyContext() (*signature.PolicyContext, error)

DefaultPolicyContext returns a signature-policy context that accepts any image signature. v1 of diffah does not verify signatures; the caller is responsible for releasing the context via Destroy.

func OpenArchiveRef added in v0.2.0

func OpenArchiveRef(path string) (types.ImageReference, error)

func OptionalBoolPtr added in v0.2.0

func OptionalBoolPtr(v bool) *bool

OptionalBoolPtr returns a pointer to v. Used when constructing SystemContextFlags to distinguish "flag not set" (nil) from explicit true/false.

func ParseReference

func ParseReference(ref string) (types.ImageReference, error)

ParseReference parses a "transport:reference" string and returns the corresponding types.ImageReference. The error wraps the input value so callers can surface what was rejected.

func ResolveAuthFile added in v0.2.0

func ResolveAuthFile() string

ResolveAuthFile returns the first existing file in the standard containers-image precedence chain:

  1. $REGISTRY_AUTH_FILE
  2. $XDG_RUNTIME_DIR/containers/auth.json
  3. $HOME/.docker/config.json

Returns an empty string when none of the candidates exist (upstream containers-image treats this as "no credentials available"). Callers outside this package use this for diagnostic display (e.g., diffah doctor's authfile check); callers inside the package use it to seed SystemContext.AuthFilePath.

func SniffArchiveFormat added in v0.2.0

func SniffArchiveFormat(path string) (string, error)

Types

type SystemContextFlags added in v0.2.0

type SystemContextFlags struct {
	AuthFile      string
	Creds         string
	Username      string
	Password      string
	NoCreds       bool
	RegistryToken string
	TLSVerify     *bool // nil = default; true/false = user override
	CertDir       string
	RetryTimes    int
	RetryDelay    time.Duration
}

SystemContextFlags holds the raw CLI-flag values that BuildSystemContext translates into an upstream *types.SystemContext. The consumer (cmd/registry_flags.go) registers these as cobra flags and fills the struct.

Jump to

Keyboard shortcuts

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