feat: Engram sync layer — swarm memory protocol, peer delta sync, distributed activation
This commit is contained in:
@@ -187,6 +187,34 @@ mod sled_impl {
|
||||
pub fn edge_count(&self) -> EngramResult<usize> {
|
||||
graph::edge_count(&self.db)
|
||||
}
|
||||
|
||||
// ── Bulk scan (for sync) ───────────────────────────────────────────────
|
||||
|
||||
/// Scan all nodes in the store.
|
||||
///
|
||||
/// Used by the sync engine to generate delta snapshots.
|
||||
pub fn scan_nodes(&self) -> EngramResult<Vec<crate::types::Node>> {
|
||||
storage::scan_nodes(&self.db)
|
||||
}
|
||||
|
||||
/// Scan all edges in the store (forward index only).
|
||||
pub fn scan_edges(&self) -> EngramResult<Vec<Edge>> {
|
||||
let prefix = b"edges:from:";
|
||||
let mut edges = Vec::new();
|
||||
for result in self.db.scan_prefix(prefix) {
|
||||
let (_k, v) = result?;
|
||||
let edge: Edge = bincode::deserialize(&v)?;
|
||||
edges.push(edge);
|
||||
}
|
||||
Ok(edges)
|
||||
}
|
||||
|
||||
/// Delete a node by UUID (tombstone support for sync).
|
||||
pub fn delete_node(&self, id: Uuid) -> EngramResult<()> {
|
||||
let key = storage::node_key(id);
|
||||
self.db.remove(key)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user