Skip to main content

LpgStore

Struct LpgStore 

Source
pub struct LpgStore { /* private fields */ }
Expand description

The main LPG graph store.

This is the core storage for labeled property graphs, providing efficient node/edge storage and adjacency indexing.

Implementations§

Source§

impl LpgStore

Source

pub fn new() -> Self

Creates a new LPG store with default configuration.

Source

pub fn with_config(config: LpgStoreConfig) -> Self

Creates a new LPG store with custom configuration.

Source

pub fn current_epoch(&self) -> EpochId

Returns the current epoch.

Source

pub fn new_epoch(&self) -> EpochId

Creates a new epoch.

Source

pub fn create_node(&self, labels: &[&str]) -> NodeId

Creates a new node with the given labels.

Uses the system transaction for non-transactional operations.

Source

pub fn create_node_versioned( &self, labels: &[&str], epoch: EpochId, tx_id: TxId, ) -> NodeId

Creates a new node with the given labels within a transaction context.

Source

pub fn create_node_with_props( &self, labels: &[&str], properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>, ) -> NodeId

Creates a new node with labels and properties.

Source

pub fn create_node_with_props_versioned( &self, labels: &[&str], properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>, epoch: EpochId, tx_id: TxId, ) -> NodeId

Creates a new node with labels and properties within a transaction context.

Source

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

Gets a node by ID (latest visible version).

Source

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

Gets a node by ID at a specific epoch.

Source

pub fn get_node_versioned( &self, id: NodeId, epoch: EpochId, tx_id: TxId, ) -> Option<Node>

Gets a node visible to a specific transaction.

Source

pub fn delete_node(&self, id: NodeId) -> bool

Deletes a node and all its edges (using latest epoch).

Source

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

Deletes a node at a specific epoch.

Source

pub fn delete_node_edges(&self, node_id: NodeId)

Deletes all edges connected to a node (for DETACH DELETE).

Source

pub fn set_node_property(&self, id: NodeId, key: &str, value: Value)

Sets a property on a node.

Source

pub fn set_edge_property(&self, id: EdgeId, key: &str, value: Value)

Sets a property on an edge.

Source

pub fn remove_node_property(&self, id: NodeId, key: &str) -> Option<Value>

Removes a property from a node.

Returns the previous value if it existed, or None if the property didn’t exist.

Source

pub fn remove_edge_property(&self, id: EdgeId, key: &str) -> Option<Value>

Removes a property from an edge.

Returns the previous value if it existed, or None if the property didn’t exist.

Source

pub fn add_label(&self, node_id: NodeId, label: &str) -> bool

Adds a label to a node.

Returns true if the label was added, false if the node doesn’t exist or already has the label.

Source

pub fn remove_label(&self, node_id: NodeId, label: &str) -> bool

Removes a label from a node.

Returns true if the label was removed, false if the node doesn’t exist or doesn’t have the label.

Source

pub fn node_count(&self) -> usize

Returns the number of nodes (non-deleted at current epoch).

Source

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

Returns all node IDs in the store.

This returns a snapshot of current node IDs. The returned vector excludes deleted nodes.

Source

pub fn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId

Creates a new edge.

Source

pub fn create_edge_versioned( &self, src: NodeId, dst: NodeId, edge_type: &str, epoch: EpochId, tx_id: TxId, ) -> EdgeId

Creates a new edge within a transaction context.

Source

pub fn create_edge_with_props( &self, src: NodeId, dst: NodeId, edge_type: &str, properties: impl IntoIterator<Item = (impl Into<PropertyKey>, impl Into<Value>)>, ) -> EdgeId

Creates a new edge with properties.

Source

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

Gets an edge by ID (latest visible version).

Source

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

Gets an edge by ID at a specific epoch.

Source

pub fn get_edge_versioned( &self, id: EdgeId, epoch: EpochId, tx_id: TxId, ) -> Option<Edge>

Gets an edge visible to a specific transaction.

Source

pub fn delete_edge(&self, id: EdgeId) -> bool

Deletes an edge (using latest epoch).

Source

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

Deletes an edge at a specific epoch.

Source

pub fn edge_count(&self) -> usize

Returns the number of edges (non-deleted at current epoch).

Source

pub fn discard_uncommitted_versions(&self, tx_id: TxId)

Discards all uncommitted versions created by a transaction.

This is called during transaction rollback to clean up uncommitted changes. The method removes version chain entries created by the specified transaction.

Source

pub fn label_count(&self) -> usize

Returns the number of distinct labels in the store.

Source

pub fn property_key_count(&self) -> usize

Returns the number of distinct property keys in the store.

This counts unique property keys across both nodes and edges.

Source

pub fn edge_type_count(&self) -> usize

Returns the number of distinct edge types in the store.

Source

pub fn neighbors( &self, node: NodeId, direction: Direction, ) -> impl Iterator<Item = NodeId> + '_

Returns an iterator over neighbors of a node.

Source

pub fn edges_from( &self, node: NodeId, direction: Direction, ) -> impl Iterator<Item = (NodeId, EdgeId)> + '_

Returns edges from a node with their targets.

Returns an iterator of (target_node, edge_id) pairs.

Source

pub fn edge_type(&self, id: EdgeId) -> Option<Arc<str>>

Gets the type of an edge by ID.

Source

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

Returns nodes with a specific label.

Source

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

Checks if a node property predicate might match any nodes.

Uses zone maps for early filtering. Returns true if there might be matching nodes, false if there definitely aren’t.

Source

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

Checks if an edge property predicate might match any edges.

Source

pub fn node_property_zone_map( &self, property: &PropertyKey, ) -> Option<ZoneMapEntry>

Gets the zone map for a node property.

Source

pub fn edge_property_zone_map( &self, property: &PropertyKey, ) -> Option<ZoneMapEntry>

Gets the zone map for an edge property.

Source

pub fn rebuild_zone_maps(&self)

Rebuilds zone maps for all properties.

Source

pub fn statistics(&self) -> Statistics

Returns the current statistics.

Source

pub fn compute_statistics(&self)

Updates statistics from current data.

This scans all labels and edge types to compute cardinality statistics.

Source

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

Estimates cardinality for a label scan.

Source

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

Estimates average degree for an edge type.

Source

pub fn create_node_with_id(&self, id: NodeId, labels: &[&str])

Creates a node with a specific ID during recovery.

This is used for WAL recovery to restore nodes with their original IDs. The caller must ensure IDs don’t conflict with existing nodes.

Source

pub fn create_edge_with_id( &self, id: EdgeId, src: NodeId, dst: NodeId, edge_type: &str, )

Creates an edge with a specific ID during recovery.

This is used for WAL recovery to restore edges with their original IDs.

Source

pub fn set_epoch(&self, epoch: EpochId)

Sets the current epoch during recovery.

Trait Implementations§

Source§

impl Default for LpgStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.