Optimize handlers to avoid deep clones of KnowledgeGraph, and fix database write concurrency issues

This commit is contained in:
Riz Ashraf committed 2026-09-21 06:53:32 +01:00
1 parent 7a48fa5d34
commit 9b349e6459
4 files changed
+197 -170

No files matched your search

+7
View File
@@ -49,6 +49,13 @@ impl MemoryState {
self.graph.read()
}
pub fn read_graph<F, R>(&self, f: F) -> R
where
F: FnOnce(&KnowledgeGraph) -> R,
{
self.graph.read_with(f)
}
pub fn modify_graph<F: FnOnce(&mut KnowledgeGraph)>(&self, update_fn: F) {
self.graph.modify(update_fn);
}