store: remove Vec<Relation>, dedup uses index iteration

The relations Vec is gone from Store. dedup now iterates via
edges_for_uuid() instead of mutating in-memory Vec — removes/re-adds
edges through the index directly.

Removed load_relations_vec() and clear_relations() — no longer needed.
Added helper methods: edges_for_uuid, index_relation, remove_relation_from_index.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-13 21:32:48 -04:00
commit 2548ca059d
5 changed files with 105 additions and 78 deletions

View file

@ -209,18 +209,6 @@ pub fn remove_relation(
Ok(())
}
/// Clear all relations from the index.
pub fn clear_relations(db: &Database) -> Result<()> {
let txn = db.begin_write()?;
{
// Drop and recreate the table
txn.delete_multimap_table(RELS)?;
let _ = txn.open_multimap_table(RELS)?;
}
txn.commit()?;
Ok(())
}
/// Get all edges for a node. Returns (other_uuid, strength, rel_type, is_outgoing).
pub fn edges_for_node(db: &Database, node_uuid: &[u8; 16]) -> Result<Vec<([u8; 16], f32, u8, bool)>> {
let txn = db.begin_read()?;