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:
parent
c2de14dcab
commit
2548ca059d
5 changed files with 105 additions and 78 deletions
|
|
@ -28,13 +28,12 @@ impl Store {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Add a relation (appends to log + updates cache + indexes)
|
||||
/// Add a relation (appends to log + indexes)
|
||||
pub fn add_relation(&mut self, rel: Relation) -> Result<()> {
|
||||
self.append_relations(std::slice::from_ref(&rel))?;
|
||||
if let Some(db) = &self.db {
|
||||
index::index_relation(db, &rel.source, &rel.target, rel.strength, rel.rel_type as u8)?;
|
||||
}
|
||||
self.relations.push(rel);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue