Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore: Send + Sync {
Show 45 methods // Required methods fn get_node(&self, id: NodeId) -> Option<Node>; fn get_edge(&self, id: EdgeId) -> Option<Edge>; fn get_node_versioned( &self, id: NodeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<Node>; fn get_edge_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<Edge>; fn get_node_at_epoch(&self, id: NodeId, epoch: EpochId) -> Option<Node>; fn get_edge_at_epoch(&self, id: EdgeId, epoch: EpochId) -> Option<Edge>; fn get_node_property(&self, id: NodeId, key: &PropertyKey) -> Option<Value>; fn get_edge_property(&self, id: EdgeId, key: &PropertyKey) -> Option<Value>; fn get_node_property_batch( &self, ids: &[NodeId], key: &PropertyKey, ) -> Vec<Option<Value>>; fn get_nodes_properties_batch( &self, ids: &[NodeId], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>; fn get_nodes_properties_selective_batch( &self, ids: &[NodeId], keys: &[PropertyKey], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>; fn get_edges_properties_selective_batch( &self, ids: &[EdgeId], keys: &[PropertyKey], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>; fn neighbors(&self, node: NodeId, direction: Direction) -> Vec<NodeId>; fn edges_from( &self, node: NodeId, direction: Direction, ) -> Vec<(NodeId, EdgeId)>; fn out_degree(&self, node: NodeId) -> usize; fn in_degree(&self, node: NodeId) -> usize; fn has_backward_adjacency(&self) -> bool; fn node_ids(&self) -> Vec<NodeId>; fn nodes_by_label(&self, label: &str) -> Vec<NodeId>; fn node_count(&self) -> usize; fn edge_count(&self) -> usize; fn edge_type(&self, id: EdgeId) -> Option<ArcStr>; fn find_nodes_by_property( &self, property: &str, value: &Value, ) -> Vec<NodeId>; fn find_nodes_by_properties( &self, conditions: &[(&str, Value)], ) -> Vec<NodeId>; fn find_nodes_in_range( &self, property: &str, min: Option<&Value>, max: Option<&Value>, min_inclusive: bool, max_inclusive: bool, ) -> Vec<NodeId>; fn node_property_might_match( &self, property: &PropertyKey, op: CompareOp, value: &Value, ) -> bool; fn edge_property_might_match( &self, property: &PropertyKey, op: CompareOp, value: &Value, ) -> bool; fn statistics(&self) -> Arc<Statistics>; fn estimate_label_cardinality(&self, label: &str) -> f64; fn estimate_avg_degree(&self, edge_type: &str, outgoing: bool) -> f64; fn current_epoch(&self) -> EpochId; // Provided methods fn all_node_ids(&self) -> Vec<NodeId> { ... } fn edge_type_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<ArcStr> { ... } fn has_property_index(&self, _property: &str) -> bool { ... } fn all_labels(&self) -> Vec<String> { ... } fn all_edge_types(&self) -> Vec<String> { ... } fn all_property_keys(&self) -> Vec<String> { ... } fn is_node_visible_at_epoch(&self, id: NodeId, epoch: EpochId) -> bool { ... } fn is_node_visible_versioned( &self, id: NodeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool { ... } fn is_edge_visible_at_epoch(&self, id: EdgeId, epoch: EpochId) -> bool { ... } fn is_edge_visible_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool { ... } fn filter_visible_node_ids( &self, ids: &[NodeId], epoch: EpochId, ) -> Vec<NodeId> { ... } fn filter_visible_node_ids_versioned( &self, ids: &[NodeId], epoch: EpochId, transaction_id: TransactionId, ) -> Vec<NodeId> { ... } fn get_node_history( &self, _id: NodeId, ) -> Vec<(EpochId, Option<EpochId>, Node)> { ... } fn get_edge_history( &self, _id: EdgeId, ) -> Vec<(EpochId, Option<EpochId>, Edge)> { ... }
}
Expand description

Read-only graph operations used by the query engine.

This trait captures the minimal surface that scan, expand, filter, project, and shortest-path operators need. Implementations may serve data from memory, disk, or a hybrid of both.

§Object safety

This trait is object-safe: you can use Arc<dyn GraphStore> for dynamic dispatch. Traversal methods return Vec instead of impl Iterator to enable this.

Required Methods§

Source

fn get_node(&self, id: NodeId) -> Option<Node>

Returns a node by ID (latest visible version at current epoch).

Source

fn get_edge(&self, id: EdgeId) -> Option<Edge>

Returns an edge by ID (latest visible version at current epoch).

Source

fn get_node_versioned( &self, id: NodeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<Node>

Returns a node visible to a specific transaction.

Source

fn get_edge_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<Edge>

Returns an edge visible to a specific transaction.

Source

fn get_node_at_epoch(&self, id: NodeId, epoch: EpochId) -> Option<Node>

Returns a node using pure epoch-based visibility (no transaction context).

The node is visible if created_epoch <= epoch and not deleted at or before epoch. Used for time-travel queries where transaction ownership must not bypass the epoch check.

Source

fn get_edge_at_epoch(&self, id: EdgeId, epoch: EpochId) -> Option<Edge>

Returns an edge using pure epoch-based visibility (no transaction context).

Source

fn get_node_property(&self, id: NodeId, key: &PropertyKey) -> Option<Value>

Gets a single property from a node without loading all properties.

Source

fn get_edge_property(&self, id: EdgeId, key: &PropertyKey) -> Option<Value>

Gets a single property from an edge without loading all properties.

Source

fn get_node_property_batch( &self, ids: &[NodeId], key: &PropertyKey, ) -> Vec<Option<Value>>

Gets a property for multiple nodes in a single batch operation.

Source

fn get_nodes_properties_batch( &self, ids: &[NodeId], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>

Gets all properties for multiple nodes in a single batch operation.

Source

fn get_nodes_properties_selective_batch( &self, ids: &[NodeId], keys: &[PropertyKey], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>

Gets selected properties for multiple nodes (projection pushdown).

Source

fn get_edges_properties_selective_batch( &self, ids: &[EdgeId], keys: &[PropertyKey], ) -> Vec<HashMap<PropertyKey, Value, RandomState>>

Gets selected properties for multiple edges (projection pushdown).

Source

fn neighbors(&self, node: NodeId, direction: Direction) -> Vec<NodeId>

Returns neighbor node IDs in the specified direction.

Returns Vec instead of an iterator for object safety. The underlying ChunkedAdjacency already produces a Vec internally.

Source

fn edges_from( &self, node: NodeId, direction: Direction, ) -> Vec<(NodeId, EdgeId)>

Returns (target_node, edge_id) pairs for edges from a node.

Source

fn out_degree(&self, node: NodeId) -> usize

Returns the out-degree of a node (number of outgoing edges).

Source

fn in_degree(&self, node: NodeId) -> usize

Returns the in-degree of a node (number of incoming edges).

Source

fn has_backward_adjacency(&self) -> bool

Whether backward adjacency is available for incoming edge queries.

Source

fn node_ids(&self) -> Vec<NodeId>

Returns all non-deleted node IDs, sorted by ID.

Source

fn nodes_by_label(&self, label: &str) -> Vec<NodeId>

Returns node IDs with a specific label.

Source

fn node_count(&self) -> usize

Returns the total number of non-deleted nodes.

Source

fn edge_count(&self) -> usize

Returns the total number of non-deleted edges.

Source

fn edge_type(&self, id: EdgeId) -> Option<ArcStr>

Returns the type string of an edge.

Source

fn find_nodes_by_property(&self, property: &str, value: &Value) -> Vec<NodeId>

Finds all nodes with a specific property value. Uses indexes when available.

Source

fn find_nodes_by_properties(&self, conditions: &[(&str, Value)]) -> Vec<NodeId>

Finds nodes matching multiple property equality conditions.

Source

fn find_nodes_in_range( &self, property: &str, min: Option<&Value>, max: Option<&Value>, min_inclusive: bool, max_inclusive: bool, ) -> Vec<NodeId>

Finds nodes whose property value falls within a range.

Source

fn node_property_might_match( &self, property: &PropertyKey, op: CompareOp, value: &Value, ) -> bool

Returns true if a node property predicate might match any nodes. Uses zone maps for early filtering.

Source

fn edge_property_might_match( &self, property: &PropertyKey, op: CompareOp, value: &Value, ) -> bool

Returns true if an edge property predicate might match any edges.

Source

fn statistics(&self) -> Arc<Statistics>

Returns the current statistics snapshot (cheap Arc clone).

Source

fn estimate_label_cardinality(&self, label: &str) -> f64

Estimates cardinality for a label scan.

Source

fn estimate_avg_degree(&self, edge_type: &str, outgoing: bool) -> f64

Estimates average degree for an edge type.

Source

fn current_epoch(&self) -> EpochId

Returns the current MVCC epoch.

Provided Methods§

Source

fn all_node_ids(&self) -> Vec<NodeId>

Returns all node IDs including uncommitted/PENDING versions.

Unlike node_ids() which pre-filters by current epoch, this method returns every node that has a version chain entry. Used by scan operators that perform their own MVCC visibility filtering (e.g. with transaction context).

Source

fn edge_type_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> Option<ArcStr>

Returns the type string of an edge visible to a specific transaction.

Falls back to epoch-based edge_type if not overridden.

Source

fn has_property_index(&self, _property: &str) -> bool

Returns true if a property index exists for the given property.

The default returns false, which is correct for stores without indexes.

Source

fn all_labels(&self) -> Vec<String>

Returns all label names in the database.

Source

fn all_edge_types(&self) -> Vec<String>

Returns all edge type names in the database.

Source

fn all_property_keys(&self) -> Vec<String>

Returns all property key names used in the database.

Source

fn is_node_visible_at_epoch(&self, id: NodeId, epoch: EpochId) -> bool

Checks if a node is visible at the given epoch without building the full Node.

More efficient than get_node_at_epoch(...).is_some() because it skips label and property loading. Override in concrete stores for optimal performance.

Source

fn is_node_visible_versioned( &self, id: NodeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool

Checks if a node is visible to a specific transaction without building the full Node.

Source

fn is_edge_visible_at_epoch(&self, id: EdgeId, epoch: EpochId) -> bool

Checks if an edge is visible at the given epoch without building the full Edge.

More efficient than get_edge_at_epoch(...).is_some() because it skips type name resolution and property loading. Override in concrete stores for optimal performance.

Source

fn is_edge_visible_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool

Checks if an edge is visible to a specific transaction without building the full Edge.

Source

fn filter_visible_node_ids(&self, ids: &[NodeId], epoch: EpochId) -> Vec<NodeId>

Filters node IDs to only those visible at the given epoch (batch).

More efficient than per-node calls because implementations can hold a single lock for the entire batch.

Source

fn filter_visible_node_ids_versioned( &self, ids: &[NodeId], epoch: EpochId, transaction_id: TransactionId, ) -> Vec<NodeId>

Filters node IDs to only those visible to a transaction (batch).

Source

fn get_node_history(&self, _id: NodeId) -> Vec<(EpochId, Option<EpochId>, Node)>

Returns all versions of a node with their creation/deletion epochs, newest first.

Each entry is (created_epoch, deleted_epoch, Node). Properties and labels reflect the current state (they are not versioned per-epoch).

Default returns empty (not all backends track version history).

Source

fn get_edge_history(&self, _id: EdgeId) -> Vec<(EpochId, Option<EpochId>, Edge)>

Returns all versions of an edge with their creation/deletion epochs, newest first.

Each entry is (created_epoch, deleted_epoch, Edge). Properties reflect the current state (they are not versioned per-epoch).

Default returns empty (not all backends track version history).

Implementors§