1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! RFC 015-A — Cache invalidation substrate (interface-first).
//!
//! ## Why this module exists
//!
//! Per gpt-5.5 brainstorm 7c36ea8b: RFC 011 (forget) and RFC 015 (caching)
//! have a circular dependency. Caches need to know about tombstones to
//! avoid serving deleted data; tombstones need an invalidation channel
//! to push notifications to caches.
//!
//! The brainstorm-locked resolution: **015-A ships first with
//! interface-only contracts**:
//!
//! 1. [`TombstoneProvider`] trait — what any cache asks: "is this rid
//! tombstoned for this tenant?"
//! 2. [`NoopTombstoneProvider`] — stub impl returning "no tombstones."
//! Lets early integration land before RFC 011 ships the real impl.
//! 3. [`TombstoneAwareCache`] — generic wrapper that filters cached
//! entries through a `TombstoneProvider` on every read.
//! 4. [`InvalidationBus`] — fan-out channel for cache invalidation
//! events. Workers subscribe; the commit-log apply path publishes.
//!
//! After this PR ships:
//! - RFC 011-A implements `TombstoneProvider` over `memory_commit_log`.
//! - RFC 015-B-1 builds query-result-cache + embedding-cache on top of
//! `TombstoneAwareCache`.
//! - RFC 015-B-2 builds hybrid BM25 + rerank using these primitives.
//!
//! ## What this is NOT
//!
//! - A concrete cache. Concrete caches (query result, embedding, hot rid)
//! are RFC 015-B work.
//! - A complete forget implementation. RFC 011-A wires
//! `TombstoneProvider` to the actual commit log; 011-B adds the
//! HNSW delete queue and crypto-shred.
//!
//! ## Generic over `K, V` because we don't know the concrete shapes yet
//!
//! Different caches key on different things:
//! - Query result cache: `(query_embedding_hash, namespace, top_k)` →
//! `Vec<RecallResult>`
//! - Embedding cache: `text_hash` → `Vec<f32>`
//! - Hot rid cache: `rid` → expanded memory record
//!
//! The trait + wrapper are generic so we don't bake in any concrete
//! shape. Each consumer picks K and V to match its workload.
pub use ;
pub use ;
pub use ;
pub use ;