Expand description
Content-addressed result cache with dependency tracking for lanekeep.
A single-file, content-addressed store holding the violations, facts and tracked read dependencies of each file.
The cache is disposable by design: any read error means a cold recompute, never a failure. That is what makes a purpose-built on-disk format acceptable rather than reckless — nothing here can break a run, so the worst a format bug can do is cost time.
§A hit needs two things
- The key matches — same engine, same host API, same grammar, same ruleset, same
config, same path, same bytes. See
key. - Every dependency still hashes the same — because
ctx.readFilelets a result depend on files other than the one being checked. Seevalidate.
The second is what makes the first safe. Without it a rule that read package.json would
keep its verdict after package.json changed, and nothing about the checked file would
have changed to say otherwise.
§The asymmetry that shapes everything here
Over-invalidating costs a recompute. Under-invalidating reports a stale answer and gives no sign it did — the output looks exactly like a correct one. So every doubtful input goes in the key, one damaged entry discards the whole file, and a dependency that cannot be hashed counts as changed.
Re-exports§
pub use entry::Entry;pub use key::CacheKey;pub use key::FORMAT_VERSION;pub use key::GrammarKey;pub use key::RunKey;pub use store::Store;
Modules§
- entry
- What a cache entry holds, and how it is encoded.
- key
- What decides whether a cached result may be used.
- store
- The on-disk store: one file, read whole, written by atomic rename.
Functions§
- hash_
bytes - Hash a file’s bytes for use as a cache-key input.
- validate
- Whether every dependency an entry recorded still holds.