pub fn adapter_id_hash(name: &str, generation: u64) -> u64Expand description
Stable u64 identity for an adapter, derived from its human NAME (never the runtime pool slot index, which is reused across swap/rotation). Task #24: this is the cache-identity key that keeps the KV/prefix cache adapter-correct so a request reuses ONLY blocks computed under the same adapter.
FNV-1a over the name bytes. 0 is the RESERVED base/no-adapter sentinel, so
a real name that would hash to 0 is bumped to 1 — a real adapter never aliases
base. Two different names never collide (modulo the 64-bit hash); the SAME
adapter re-staged into a different pool slot keeps its name, hence its id.
Task #25 (slot generation): generation folds into the identity ONLY when it
is non-zero, so generation == 0 returns byte-identically to the pre-#25
value (first-load ids and the base sentinel are unchanged — the #24 base
byte-identity pins hold). A re-staged slot bumps its generation, changing the
id so a later request under the SAME name misses the stale prior-generation
prefix/KV. The if h == 0 { 1 } base-reserve is re-applied AFTER the fold so
no (name, generation) pair can alias the base sentinel.