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 rename_node(&mut self, old_key: &str, new_key: &str) -> &mut Self
pub fn rename_node(&mut self, old_key: &str, new_key: &str) -> &mut Self
Queue a node-rename in this batch.
Validation (old exists, new not taken) runs at commit time.
Sourcepub fn insert_edge_upsert(
&mut self,
edge_type: &str,
src_key: &str,
dst_key: &str,
placeholder_label: &str,
) -> &mut Self
pub fn insert_edge_upsert( &mut self, edge_type: &str, src_key: &str, dst_key: &str, placeholder_label: &str, ) -> &mut Self
Queue an edge insert with endpoint auto-creation.
Any missing endpoint is created as a plain node {key, label: placeholder_label, no props} inside this batch frame. Rules fire and
last-change is updated for each auto-created node.
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.
Auto Trait Implementations§
impl<'a, F> !RefUnwindSafe for BatchBuilder<'a, F>
impl<'a, F> !UnwindSafe for BatchBuilder<'a, F>
impl<'a, F> Freeze for BatchBuilder<'a, F>
impl<'a, F> Send for BatchBuilder<'a, F>
impl<'a, F> Sync for BatchBuilder<'a, F>
impl<'a, F> Unpin for BatchBuilder<'a, F>
impl<'a, F> UnsafeUnpin for BatchBuilder<'a, F>where
&'a mut GraphDb<F>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.