pub struct EdgeStore<'a> { /* private fields */ }Expand description
Edge store manages edge records and adjacency layout in the graph file
This implementation delegates to modularized components for clean separation of concerns while preserving the original API signature for compatibility.
Implementations§
Source§impl<'a> EdgeStore<'a>
impl<'a> EdgeStore<'a>
Sourcepub fn write_edge(&mut self, edge: &EdgeRecord) -> NativeResult<()>
pub fn write_edge(&mut self, edge: &EdgeRecord) -> NativeResult<()>
Write an edge record to the store with V2 cluster metadata integration This is the recommended method for V2 systems as it properly updates node cluster metadata
Sourcepub fn read_edge(&mut self, edge_id: NativeEdgeId) -> NativeResult<EdgeRecord>
pub fn read_edge(&mut self, edge_id: NativeEdgeId) -> NativeResult<EdgeRecord>
Read an edge record from the store
Sourcepub fn max_edge_id(&mut self) -> NativeEdgeId
pub fn max_edge_id(&mut self) -> NativeEdgeId
Get the maximum edge ID
Sourcepub fn allocate_edge_id(&mut self) -> NativeEdgeId
pub fn allocate_edge_id(&mut self) -> NativeEdgeId
Allocate a new edge ID with capacity coordination
Sourcepub fn delete_edge(&mut self, edge_id: NativeEdgeId) -> NativeResult<()>
pub fn delete_edge(&mut self, edge_id: NativeEdgeId) -> NativeResult<()>
Delete an edge by marking it as deleted (soft deletion)
This marks the edge as deleted by setting a flag in the edge record. The edge record remains in storage but is marked as deleted.
§Arguments
edge_id- The ID of the edge to delete
§Returns
Ok(()) if the edge was successfully marked as deleted
§Note
This is a soft deletion - the edge record remains but is marked as deleted. This is reversible for rollback scenarios.
Sourcepub fn iter_neighbors(
&mut self,
node_id: NativeNodeId,
direction: Direction,
) -> Box<dyn Iterator<Item = NativeNodeId> + '_>
pub fn iter_neighbors( &mut self, node_id: NativeNodeId, direction: Direction, ) -> Box<dyn Iterator<Item = NativeNodeId> + '_>
Iterate over neighbors of a node using V2 cluster adjacency Returns node IDs that are connected to the specified node in the given direction AVOIDS CIRCULAR DEPENDENCY: Uses direct edge iteration instead of AdjacencyIterator
Sourcepub fn iter_edges_with_ids(
&mut self,
node_id: NativeNodeId,
direction: Direction,
) -> Box<dyn Iterator<Item = (NativeEdgeId, NativeNodeId)> + '_>
pub fn iter_edges_with_ids( &mut self, node_id: NativeNodeId, direction: Direction, ) -> Box<dyn Iterator<Item = (NativeEdgeId, NativeNodeId)> + '_>
Iterate edges for a node, returning edge IDs and neighbor node IDs
This is similar to iter_neighbors but returns both edge_id and neighbor_id for each edge. This enables operations like edge cascade cleanup where edge IDs are needed.
§Arguments
node_id- The node to iterate edges fordirection- Outgoing (edges from this node) or Incoming (edges to this node)
§Returns
Iterator of (edge_id, neighbor_id) tuples
§Performance Note
This scans all edge records in the database (1 to header.edge_count), which is O(N) where N is the total number of edges. For large graphs, consider adding an index.
Sourcepub fn allocate_outgoing_adjacency(
&mut self,
node_id: NativeNodeId,
count: u32,
) -> NativeResult<FileOffset>
pub fn allocate_outgoing_adjacency( &mut self, node_id: NativeNodeId, count: u32, ) -> NativeResult<FileOffset>
Allocate adjacency space for outgoing edges
Sourcepub fn allocate_incoming_adjacency(
&mut self,
node_id: NativeNodeId,
count: u32,
) -> NativeResult<FileOffset>
pub fn allocate_incoming_adjacency( &mut self, node_id: NativeNodeId, count: u32, ) -> NativeResult<FileOffset>
Allocate adjacency space for incoming edges