Optimize handlers to avoid deep clones of KnowledgeGraph, and fix database write concurrency issues
This commit is contained in:
1 parent
7a48fa5d34
commit
9b349e6459
4 files changed
+197
-170
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user