Skip to main content

Module derived_cache

Module derived_cache 

Source
Expand description

Content-addressed derived-index cache (ADR-099/ADR-112) — port of services/derived_cache.py DerivedIndexCache.load_or_build plus the stat-manifest freshness rungs of services/freshness.py the one-shot path consumes (INDEX-PLAN B3).

Every failure mode degrades to a fresh build: enabling the cache can only change latency, never an answer or an exit code (ADR-080).

Structs§

DerivedIndexCache

Enums§

ReadModel
What load_or_build returns: a memory-mapped store view (the warm path), or the freshly built structures when the store could not be written or reopened (ADR-080 — never a failure).

Constants§

CACHE_DIR_ENV

Functions§

cache_enabled
Whether the persistent cache is active for this invocation (ADR-112): on by default; --no-cache per invocation, non-empty DECIDED_NO_CACHE environment-wide.
corpus_hash_from_complete_manifest
Recompose the corpus hash from a complete scan-order manifest without a second filesystem walk. stat_scan always returns exactly this shape.
corpus_hash_from_manifest
Reproduce corpus_content_hash from the manifest’s cached hashes.
default_cache_dir
The derived-cache directory ladder: DECIDED_CACHE_DIR > $XDG_CACHE_HOME/decisions/derived > ~/.cache/decisions/derived > <tmp>/decided-cache/decisions/derived (the homeless floor — never raises).
stat_scan
Diff the corpus against prev_manifest by stat, content-confirming changes. Returns the rebuilt manifest (scan order) and the changed set.
write_marker_public
The tracker’s compaction gate (INDEX-PLAN B6): write the marker for an already-landed store.