pub enum WitnessKey {
Page(PageNumber),
Cell {
btree_root: PageNumber,
leaf_page: PageNumber,
tag: u64,
},
ByteRange {
page: PageNumber,
start: u32,
len: u32,
},
KeyRange {
btree_root: PageNumber,
lo: Vec<u8>,
hi: Vec<u8>,
},
Custom {
namespace: u32,
bytes: Vec<u8>,
},
}Expand description
SSI witness key basis (§5.6.4.3).
Canonical key space for SSI rw-antidependency tracking. Always valid to
fall back to Page(pgno) — finer keys reduce false positives but never
compromise correctness.
Variants§
Page(PageNumber)
Coarse witness: entire page.
Cell
Semantic witness: specific B-tree cell identified by domain-separated hash.
tag is low32(xxh3_64("fsqlite:witness:cell:v1" || le_u32(btree_root) || key_bytes)).
ByteRange
Semantic witness: structured byte range on a page.
KeyRange
Key range witness for reduced false positives on range scans (optional, advanced).
Custom
Custom namespace witness (extensibility point).
Implementations§
Source§impl WitnessKey
impl WitnessKey
Sourcepub fn cell_tag(btree_root: PageNumber, canonical_key_bytes: &[u8]) -> u64
pub fn cell_tag(btree_root: PageNumber, canonical_key_bytes: &[u8]) -> u64
Derive a deterministic cell tag from a B-tree root page and canonical key bytes.
Uses domain-separated xxh3_64 (§5.6.4.3):
cell_tag = low32(xxh3_64("fsqlite:witness:cell:v1" || le_u32(btree_root_pgno) || key_bytes))
Sourcepub fn for_cell_read(
btree_root: PageNumber,
leaf_page: PageNumber,
canonical_key_bytes: &[u8],
) -> Self
pub fn for_cell_read( btree_root: PageNumber, leaf_page: PageNumber, canonical_key_bytes: &[u8], ) -> Self
Create a cell witness for a point read/uniqueness check.
Sourcepub fn for_range_scan(leaf_pages: &[PageNumber]) -> Vec<Self>
pub fn for_range_scan(leaf_pages: &[PageNumber]) -> Vec<Self>
Create page-level witnesses for a range scan (phantom protection).
Returns one Page(leaf_pgno) witness per visited leaf page (§5.6.4.3).
Sourcepub fn for_point_write(
btree_root: PageNumber,
canonical_key_bytes: &[u8],
leaf_pgno: PageNumber,
) -> (Self, Self)
pub fn for_point_write( btree_root: PageNumber, canonical_key_bytes: &[u8], leaf_pgno: PageNumber, ) -> (Self, Self)
Create a cell + page witness pair for a point write.
Writes register both Cell(btree_root, leaf_page, cell_tag) AND
Page(leaf_pgno) as write witnesses (§5.6.4.3).
Sourcepub const fn page_number(&self) -> Option<PageNumber>
pub const fn page_number(&self) -> Option<PageNumber>
Return the page-like bucket associated with this witness.
Page and byte-range witnesses map to their physical page. Cell and key-range witnesses are bucketed by their B-tree root page so higher layers can retain O(1) page/root-level witness indexes. Custom witnesses are intentionally left unbucketed.
Trait Implementations§
Source§impl Clone for WitnessKey
impl Clone for WitnessKey
Source§fn clone(&self) -> WitnessKey
fn clone(&self) -> WitnessKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more