Skip to main content

Crate gen_cache_attic

Crate gen_cache_attic 

Source
Expand description

gen-cache-attic — typed cache-probe layer for the gen engine.

The engine consults a CacheClient for every derivation before triggering a build. A hit short-circuits the rebuild; a miss flows into the local builder. The trait is the swap-in seam: today’s prime impl is NoCacheClient (always reports miss); the production impl is AtticClient (HEAD-probes the substituter URL). Future impls (cachix, R2, S3) drop in without touching the engine.

Structs§

AtticClient
Production attic client. Builds an CacheClient::probe by issuing a HEAD against <substituter>/<hash>.narinfo for each configured substituter; first 200-OK wins.
CacheKey
Typed cache key. Engines compute the input-addressed hash of the derivation (typed Manifest + adapter + target + features) into a ContentHash and consult the cache with that key. The key is what makes the cache content-addressed: same inputs → same key → same answer fleet-wide.
CacheReport
Aggregate report — one probe per supplied key.
NoCacheClient
No-cache default. Always reports miss. Used when no substituter is configured OR when cache.always_build = true.

Enums§

CacheError
CacheOutcome
Outcome of a cache probe. Either a hit (substituter has the derivation) or a miss (engine triggers the local builder).
MissReason

Traits§

CacheClient
Typed cache client. New backends (cachix, R2, S3, IPFS, …) implement this trait + plug into the engine via gen_config.

Functions§

client_from_config
Convenience constructor — selects NoCacheClient or AtticClient based on a typed CacheConfig. Engines call this once at startup + cache the boxed result.