pub struct BatchBuilder<'a, F: Fs> { /* private fields */ }Expand description
Collects mutations and commits them as one WAL Batch frame.
Holds &mut GraphDb for its lifetime. Queue with the same method names
as GraphDb; call commit to validate, log, and apply.
See GraphDb::batch for validation and atomicity rules.
Implementations§
Source§impl<'a, F: Fs> BatchBuilder<'a, F>
impl<'a, F: Fs> BatchBuilder<'a, F>
pub fn insert_node( &mut self, label: &str, key: &str, props: Vec<(String, Value)>, ) -> &mut Self
pub fn insert_edge( &mut self, edge_type: &str, src_key: &str, dst_key: &str, ) -> &mut Self
pub fn set_prop(&mut self, key: &str, field: &str, value: Value) -> &mut Self
pub fn remove_prop(&mut self, key: &str, field: &str) -> &mut Self
pub fn delete_edge( &mut self, edge_type: &str, src_key: &str, dst_key: &str, ) -> &mut Self
pub fn delete_node(&mut self, key: &str) -> &mut Self
pub fn create_rule(&mut self, def: RuleDef) -> &mut Self
pub fn delete_rule(&mut self, name: &str) -> &mut Self
Sourcepub fn commit(&mut self) -> Result<(usize, usize)>
pub fn commit(&mut self) -> Result<(usize, usize)>
Validate every queued op, then log one Batch frame and apply.
Empty / all-noop batches return Ok(()) without writing the WAL.
A second commit() after a successful one is an empty-batch no-op
(queued ops were taken).
Takes &mut self so it chains after the queue methods (b.insert_node(..).commit())
and also works as let mut b = db.batch(); b.insert_node(..); b.commit().
Rule-window limitation: batch validation cannot see edges that a
rule created earlier in the same batch will derive at apply time, so
a delete_edge / insert_edge in that window is silently no-oped
where sequential calls would return Err(RuleOwned). State integrity
is unaffected (idempotent apply, provenance intact). Create rules in
their own batch, or sequentially, when later ops may touch derived
edges.
Validate every queued op and commit atomically.
Returns (nodes_inserted, edges_inserted) — the counts of node and edge
WAL records actually written (duplicate edges are silent no-ops and are
NOT counted). Both are 0 when the batch is empty or all-noop.