Skip to main content

Module registrycache

Module registrycache 

Source
Expand description

Manages caproni’s host-side pull-through zot registry. Owns the zot binary lifecycle (start on caproni up, stop on the last caproni destroy), config templating, and the flock-protected ref counting that lets multiple profiles share a single zot instance.

Ported from internal/registrycache/registrycache.go.

Re-exports§

pub use config::ConfigError;
pub use paths::PathError;

Modules§

config
Zot config templating.
lock
Cross-process serialization for registry-cache state mutations.
paths
Filesystem layout for the host-side registry cache.
process
zot process lifecycle: spawn, liveness check, and graceful stop.
refs
Per-profile ref counting for the host-side registry cache.

Structs§

Endpoint
Describes the running zot from the cluster’s perspective. Each driver composes its own mirror URL by calling Endpoint::host_port with the host name resolvable from inside its own cluster (colima uses host.docker.internal, k3d uses host.k3d.internal).
State
Captures the result of status. Powers caproni registry status.

Enums§

RegistryCacheError
Errors from registry-cache orchestration.

Constants§

DEFAULT_PORT
The port zot listens on. Caproni picks a non-default to avoid collisions with macOS AirPlay (which binds 5000). Exported so drivers can compose their own mirror URL alongside their preferred host name; see Endpoint and each driver’s mirror-wiring code.

Functions§

ensure
Starts the host-side zot if not running, registers the given profile’s ref, regenerates the config, and returns the endpoint drivers should configure as a mirror. Idempotent. Concurrency-safe: holds an exclusive flock for the duration.
ensure_stopped_for_profile
Releases the profile’s hold on the host-side registry cache. The cache process itself is left running so the next caproni up (for this or any profile) starts warm. Use stop to explicitly tear down zot. Concurrency-safe.
start
Spawns the host-side zot process using the previously persisted config at paths::config_path. Returns Ok(()) immediately if zot is already running. Does not touch refs – this is a process-level operation, not a profile lifecycle event.
status
Reports the current state. Read-only; safe to call without the lock (concurrent mutations are short and will momentarily disagree).
stop
Stops the host-side zot process. Refs are preserved (callers that still expect the cache running can notice via status). Cached data on disk is preserved so the next ensure restarts warm. Concurrency-safe.