forked from kent/consciousness
store: add weight to index, index-only key matching
- KEY_TO_UUID now stores weight (30 bytes: uuid+type+ts+deleted+weight) - UUID_OFFSETS changed to composite key for O(log n) max-offset lookup - Add NODES_BY_TYPE index for efficient type+date range queries - Add for_each_key_weight() to StoreView for index-only iteration - match_seeds uses index-only path when content not needed - Fix transaction consistency in ops (single txn for related updates) - rebuild() now records all uuid→offset mappings for version history - Backwards compatible: old index formats decoded with default weight Co-Authored-By: Proof of Concept <poc@bcachefs.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
fc978e2f2e
commit
ba4e01b6f3
9 changed files with 774 additions and 500 deletions
|
|
@ -633,7 +633,8 @@ pub fn match_seeds_opts(
|
|||
// Build component index: word → vec of (original key, weight)
|
||||
let mut component_map: HashMap<String, Vec<(String, f64)>> = HashMap::new();
|
||||
|
||||
store.for_each_node(|key, _content, weight| {
|
||||
// Index-only pass: no capnp reads needed for key matching
|
||||
store.for_each_key_weight(|key, weight| {
|
||||
let lkey = key.to_lowercase();
|
||||
key_map.insert(lkey.clone(), (key.to_owned(), weight as f64));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue