pub struct SnapshotGraphBuilder { /* private fields */ }Expand description
Builds an InMemoryGraph from snapshot records one at a time.
A decoder that streams a snapshot pushes each record as it decodes it,
so the records are never all held at once beside the graph they fill.
Push every node before the relationships that reference it, then call
Self::finish with the catalogs, which registers the indexes and
constraints over the loaded data.
Implementations§
Source§impl SnapshotGraphBuilder
impl SnapshotGraphBuilder
pub fn new( next_node_id: NodeId, next_rel_id: RelationshipId, ) -> Result<Self, SnapshotError>
pub fn push_node(&mut self, node: NodeRecord) -> Result<(), SnapshotError>
pub fn push_relationship( &mut self, rel: RelationshipRecord, ) -> Result<(), SnapshotError>
pub fn finish( self, indexes: Vec<IndexDefinition>, constraints: Vec<ConstraintDefinition>, vector_indexes: Vec<VectorIndexSnapshot>, ) -> Result<InMemoryGraph, SnapshotError>
Source§impl SnapshotGraphBuilder
impl SnapshotGraphBuilder
Sourcepub fn prime(
&mut self,
names: &SnapshotNames,
) -> Result<SnapshotEncoder, SnapshotError>
pub fn prime( &mut self, names: &SnapshotNames, ) -> Result<SnapshotEncoder, SnapshotError>
Number the snapshot’s names in the graph being built, and return an encoder that turns records named by those numbers into the graph’s stored form on any thread. Call before pushing records.
Sourcepub fn push_nodes(&mut self, batch: NodeBatch) -> Result<(), SnapshotError>
pub fn push_nodes(&mut self, batch: NodeBatch) -> Result<(), SnapshotError>
Store nodes an encoder from Self::prime encoded.
Sourcepub fn push_relationships(
&mut self,
batch: RelationshipBatch,
) -> Result<(), SnapshotError>
pub fn push_relationships( &mut self, batch: RelationshipBatch, ) -> Result<(), SnapshotError>
Store relationships an encoder from Self::prime encoded. Their
endpoints must already be pushed.
Sourcepub fn push_relationship_batches(
&mut self,
batches: Vec<RelationshipBatch>,
) -> Result<(), SnapshotError>
pub fn push_relationship_batches( &mut self, batches: Vec<RelationshipBatch>, ) -> Result<(), SnapshotError>
Self::push_relationships for several batches, in order: their
adjacency is linked in one pass, on every core when the build
allows.
Auto Trait Implementations§
impl !Freeze for SnapshotGraphBuilder
impl !RefUnwindSafe for SnapshotGraphBuilder
impl !UnwindSafe for SnapshotGraphBuilder
impl Send for SnapshotGraphBuilder
impl Sync for SnapshotGraphBuilder
impl Unpin for SnapshotGraphBuilder
impl UnsafeUnpin for SnapshotGraphBuilder
Blanket Implementations§
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more