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
- func BuildSystemContext(f SystemContextFlags) (*types.SystemContext, error)
- func DefaultPolicyContext() (*signature.PolicyContext, error)
- func OpenArchiveRef(path string) (types.ImageReference, error)
- func OptionalBoolPtr(v bool) *bool
- func ParseReference(ref string) (types.ImageReference, error)
- func ResolveAuthFile() string
- func SniffArchiveFormat(path string) (string, error)
- type SystemContextFlags
Constants ¶
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
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:
- $REGISTRY_AUTH_FILE
- $XDG_RUNTIME_DIR/containers/auth.json
- $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
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.