pub struct InMemoryGraph { /* private fields */ }Implementations§
Source§impl InMemoryGraph
impl InMemoryGraph
pub fn new() -> Self
pub fn with_capacity_hint(_nodes: usize, _relationships: usize) -> Self
pub fn contains_node(&self, node_id: NodeId) -> bool
pub fn contains_relationship(&self, rel_id: RelationshipId) -> bool
Sourcepub fn set_mutation_recorder(
&mut self,
recorder: Option<Arc<dyn MutationRecorder>>,
)
pub fn set_mutation_recorder( &mut self, recorder: Option<Arc<dyn MutationRecorder>>, )
Install (or clear) the mutation recorder. Passing None detaches any
currently-installed recorder. The recorder observes every committed
mutation after it has been applied.
Sourcepub fn mutation_recorder(&self) -> Option<&Arc<dyn MutationRecorder>>
pub fn mutation_recorder(&self) -> Option<&Arc<dyn MutationRecorder>>
Handle to the currently-installed recorder, if any.
Trait Implementations§
Source§impl BorrowedGraphStorage for InMemoryGraph
impl BorrowedGraphStorage for InMemoryGraph
fn node_ref(&self, id: NodeId) -> Option<&NodeRecord>
fn relationship_ref(&self, id: RelationshipId) -> Option<&RelationshipRecord>
fn node_refs(&self) -> Box<dyn Iterator<Item = &NodeRecord> + '_>
fn node_refs_by_label( &self, label: &str, ) -> Box<dyn Iterator<Item = &NodeRecord> + '_>
fn relationship_refs( &self, ) -> Box<dyn Iterator<Item = &RelationshipRecord> + '_>
fn relationship_refs_by_type( &self, rel_type: &str, ) -> Box<dyn Iterator<Item = &RelationshipRecord> + '_>
Source§impl Clone for InMemoryGraph
impl Clone for InMemoryGraph
Source§impl Debug for InMemoryGraph
impl Debug for InMemoryGraph
Source§impl Default for InMemoryGraph
impl Default for InMemoryGraph
Source§fn default() -> InMemoryGraph
fn default() -> InMemoryGraph
Returns the “default value” for a type. Read more
Source§impl GraphStorage for InMemoryGraph
impl GraphStorage for InMemoryGraph
Source§fn contains_node(&self, id: NodeId) -> bool
fn contains_node(&self, id: NodeId) -> bool
Cheap existence check. Should not clone or materialize the record.
Source§fn node(&self, id: NodeId) -> Option<NodeRecord>
fn node(&self, id: NodeId) -> Option<NodeRecord>
Point lookup returning an owned record. Backends that can hand out
borrows should also implement
BorrowedGraphStorage::node_ref and
override [with_node] to avoid clones on the hot path.Source§fn all_node_ids(&self) -> Vec<NodeId> ⓘ
fn all_node_ids(&self) -> Vec<NodeId> ⓘ
Enumerate every node id. Should be O(nodes) without cloning records.
Source§fn node_ids_by_label(&self, label: &str) -> Vec<NodeId> ⓘ
fn node_ids_by_label(&self, label: &str) -> Vec<NodeId> ⓘ
Enumerate node ids carrying the given label. Implementations that keep
a label index should override this.
fn contains_relationship(&self, id: RelationshipId) -> bool
fn relationship(&self, id: RelationshipId) -> Option<RelationshipRecord>
fn all_rel_ids(&self) -> Vec<RelationshipId> ⓘ
fn rel_ids_by_type(&self, rel_type: &str) -> Vec<RelationshipId> ⓘ
Source§fn relationship_endpoints(&self, id: RelationshipId) -> Option<(NodeId, NodeId)>
fn relationship_endpoints(&self, id: RelationshipId) -> Option<(NodeId, NodeId)>
Endpoint pair
(src, dst) for a relationship. Required because
traversal uses it on hot paths; a backend that stores endpoints
alongside the id index can answer this without fetching properties.Source§fn expand_ids(
&self,
node_id: NodeId,
direction: Direction,
types: &[String],
) -> Vec<(RelationshipId, NodeId)>
fn expand_ids( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipId, NodeId)>
Expand a node’s incident relationships filtered by direction and
(optional) types. This is the single traversal primitive; variable-
length paths, degree, and adjacency helpers are all derived from it.
fn all_labels(&self) -> Vec<String>
fn all_relationship_types(&self) -> Vec<String>
fn with_node<F, R>(&self, id: NodeId, f: F) -> Option<R>
fn with_relationship<F, R>(&self, id: RelationshipId, f: F) -> Option<R>
fn node_count(&self) -> usize
fn relationship_count(&self) -> usize
fn has_node(&self, id: NodeId) -> bool
fn has_relationship(&self, id: RelationshipId) -> bool
fn all_nodes(&self) -> Vec<NodeRecord>
fn nodes_by_label(&self, label: &str) -> Vec<NodeRecord>
fn all_relationships(&self) -> Vec<RelationshipRecord>
fn relationships_by_type(&self, rel_type: &str) -> Vec<RelationshipRecord>
fn find_nodes_by_property(
&self,
label: Option<&str>,
key: &str,
value: &PropertyValue,
) -> Vec<NodeRecord>where
Self: Sized,
fn find_node_ids_by_property(
&self,
label: Option<&str>,
key: &str,
value: &PropertyValue,
) -> Vec<NodeId> ⓘwhere
Self: Sized,
fn find_relationships_by_property(
&self,
rel_type: Option<&str>,
key: &str,
value: &PropertyValue,
) -> Vec<RelationshipRecord>where
Self: Sized,
fn find_relationship_ids_by_property(
&self,
rel_type: Option<&str>,
key: &str,
value: &PropertyValue,
) -> Vec<RelationshipId> ⓘwhere
Self: Sized,
fn node_exists_with_label_and_property(
&self,
label: &str,
key: &str,
value: &PropertyValue,
) -> boolwhere
Self: Sized,
fn relationship_exists_with_type_and_property(
&self,
rel_type: &str,
key: &str,
value: &PropertyValue,
) -> boolwhere
Self: Sized,
fn relationship_ids_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipId> ⓘ
fn outgoing_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord>
fn incoming_relationships(&self, node_id: NodeId) -> Vec<RelationshipRecord>
fn degree(&self, node_id: NodeId, direction: Direction) -> usize
fn expand( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<(RelationshipRecord, NodeRecord)>
fn all_node_property_keys(&self) -> Vec<String>
fn all_relationship_property_keys(&self) -> Vec<String>
fn label_property_keys(&self, label: &str) -> Vec<String>
fn rel_type_property_keys(&self, rel_type: &str) -> Vec<String>
fn relationships_of( &self, node_id: NodeId, direction: Direction, ) -> Vec<RelationshipRecord>
fn is_isolated(&self, node_id: NodeId) -> bool
fn expand_detailed( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<ExpandedRelationship>
fn neighbors( &self, node_id: NodeId, direction: Direction, types: &[String], ) -> Vec<NodeRecord>
fn node_has_label(&self, node_id: NodeId, label: &str) -> boolwhere
Self: Sized,
fn node_labels(&self, node_id: NodeId) -> Option<Vec<String>>where
Self: Sized,
fn node_properties(&self, node_id: NodeId) -> Option<Properties>where
Self: Sized,
fn node_property(&self, node_id: NodeId, key: &str) -> Option<PropertyValue>where
Self: Sized,
fn relationship_type(&self, rel_id: RelationshipId) -> Option<String>where
Self: Sized,
fn relationship_properties(&self, rel_id: RelationshipId) -> Option<Properties>where
Self: Sized,
fn relationship_property(
&self,
rel_id: RelationshipId,
key: &str,
) -> Option<PropertyValue>where
Self: Sized,
fn relationship_source(&self, rel_id: RelationshipId) -> Option<NodeId>
fn relationship_target(&self, rel_id: RelationshipId) -> Option<NodeId>
fn other_node(&self, rel_id: RelationshipId, node_id: NodeId) -> Option<NodeId>
fn has_label_name(&self, label: &str) -> bool
fn has_relationship_type_name(&self, rel_type: &str) -> bool
fn all_property_keys(&self) -> Vec<String>where
Self: Sized,
fn has_property_key(&self, key: &str) -> boolwhere
Self: Sized,
fn label_has_property_key(&self, label: &str, key: &str) -> boolwhere
Self: Sized,
fn rel_type_has_property_key(&self, rel_type: &str, key: &str) -> boolwhere
Self: Sized,
Source§impl GraphStorageMut for InMemoryGraph
impl GraphStorageMut for InMemoryGraph
fn create_node( &mut self, labels: Vec<String>, properties: Properties, ) -> NodeRecord
fn create_relationship( &mut self, src: NodeId, dst: NodeId, rel_type: &str, properties: Properties, ) -> Option<RelationshipRecord>
fn set_node_property( &mut self, node_id: NodeId, key: String, value: PropertyValue, ) -> bool
fn remove_node_property(&mut self, node_id: NodeId, key: &str) -> bool
fn add_node_label(&mut self, node_id: NodeId, label: &str) -> bool
fn remove_node_label(&mut self, node_id: NodeId, label: &str) -> bool
fn set_relationship_property( &mut self, rel_id: RelationshipId, key: String, value: PropertyValue, ) -> bool
fn remove_relationship_property( &mut self, rel_id: RelationshipId, key: &str, ) -> bool
fn delete_relationship(&mut self, rel_id: RelationshipId) -> bool
Source§fn delete_node(&mut self, node_id: NodeId) -> bool
fn delete_node(&mut self, node_id: NodeId) -> bool
Returns false if the node still has attached relationships.
Source§fn detach_delete_node(&mut self, node_id: NodeId) -> bool
fn detach_delete_node(&mut self, node_id: NodeId) -> bool
Deletes the node and all attached relationships.
Source§fn clear(&mut self)
fn clear(&mut self)
Drop every node and every relationship, returning the store to an
empty state. Provided as a trait method so callers (bindings, admin
tools) can reset a graph without knowing the concrete backend. Read more
fn replace_node_properties(
&mut self,
node_id: NodeId,
properties: Properties,
) -> boolwhere
Self: Sized,
fn merge_node_properties( &mut self, node_id: NodeId, properties: Properties, ) -> bool
fn set_node_labels(&mut self, node_id: NodeId, labels: Vec<String>) -> boolwhere
Self: Sized,
fn replace_relationship_properties(
&mut self,
rel_id: RelationshipId,
properties: Properties,
) -> boolwhere
Self: Sized,
fn merge_relationship_properties( &mut self, rel_id: RelationshipId, properties: Properties, ) -> bool
fn delete_relationships_of( &mut self, node_id: NodeId, direction: Direction, ) -> usize
fn get_or_create_node(
&mut self,
labels: Vec<String>,
match_key: &str,
match_value: &PropertyValue,
init_properties: Properties,
) -> NodeRecordwhere
Self: Sized,
Source§impl Snapshotable for InMemoryGraph
impl Snapshotable for InMemoryGraph
fn save_snapshot<W: Write>( &self, writer: W, ) -> Result<SnapshotMeta, SnapshotError>
Source§fn save_checkpoint<W: Write>(
&self,
writer: W,
wal_lsn: u64,
) -> Result<SnapshotMeta, SnapshotError>
fn save_checkpoint<W: Write>( &self, writer: W, wal_lsn: u64, ) -> Result<SnapshotMeta, SnapshotError>
Save a snapshot stamped with a WAL log position, suitable as a
checkpoint fence. The fence is the LSN past which the WAL is
the source of truth on recovery; replay skips records at or
below it. Read more
fn load_snapshot<R: Read>( &mut self, reader: R, ) -> Result<SnapshotMeta, SnapshotError>
Auto Trait Implementations§
impl !Freeze for InMemoryGraph
impl !RefUnwindSafe for InMemoryGraph
impl Send for InMemoryGraph
impl Sync for InMemoryGraph
impl Unpin for InMemoryGraph
impl UnsafeUnpin for InMemoryGraph
impl !UnwindSafe for InMemoryGraph
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
Mutably borrows from an owned value. Read more