Skip to main content

Module daemon_client

Module daemon_client 

Source
Expand description

Daemon-aware cache client — Phase 3b of supa-charge-akeyless-ci.

DaemonAwareCacheClient implements the same StorageBackend trait the plain Phase 2 wrapper already consumes, so wiring it in is a substitution at construction time, not a change to crate::run_wrapper or its 8 Phase 2 tests: whoever builds the Arc<dyn StorageBackend> decides whether that’s a direct remote backend (today’s default) or this daemon-aware wrapper around one.

Behavior:

  • get_narinfo/put_narinfo first try to reach the node-local sui-dockerfile-node-cache-daemon over its Unix domain socket (see sui_dockerfile_node_cache_daemon::default_socket_path for the well-known integration-contract path a runner pod must mount the same hostPath volume at to reach it).
  • Daemon reachable: routes the request through it. The daemon itself may transparently fall through to the remote tier on a local L0 miss — this client does not duplicate that fetch.
  • Daemon unreachable (socket missing, or the connection attempt fails/times out): falls straight through to the remote backend passed at construction, byte-for-byte the same call this client would have made with no daemon awareness at all — the “never require the daemon, always degrade gracefully” contract.
  • put_narinfo always writes through to remote (so the shared L1/L2 tiers — and every other node’s future local misses — see the new entry), and additionally best-effort informs the daemon (if reachable) so this node’s local L0 is warm without a second round trip on the next Get. A daemon-Put failure is logged, never propagated — the remote write already succeeded and is the one that matters for correctness.
  • Every other StorageBackend method (get_nar/put_nar/ delete/list_narinfos) is delegated straight to remote unchanged — the node cache daemon only speaks the narinfo-shaped Get/Put/Warm protocol the Dockerfile-graph cache uses.

Structs§

DaemonAwareCacheClient
A StorageBackend that prefers a node-local daemon and falls through to a direct remote backend when the daemon can’t be reached. See the module docs for the exact per-method contract.

Functions§

socket_looks_present
Probe whether path looks like a live socket file. Used by callers deciding whether to construct a DaemonAwareCacheClient with Some(path) at all (a pure existence check — the client’s own connect-with-timeout handles the “exists but not accepting” case, so this is a cheap early filter, not the sole gate).