EdgeStore

Struct EdgeStore 

Source
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>

Source

pub fn new(graph_file: &'a mut GraphFile) -> Self

Create a new edge store

Source

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

Source

pub fn read_edge(&mut self, edge_id: NativeEdgeId) -> NativeResult<EdgeRecord>

Read an edge record from the store

Source

pub fn max_edge_id(&mut self) -> NativeEdgeId

Get the maximum edge ID

Source

pub fn allocate_edge_id(&mut self) -> NativeEdgeId

Allocate a new edge ID with capacity coordination

Source

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.

Source

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

Source

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 for
  • direction - 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.

Source

pub fn allocate_outgoing_adjacency( &mut self, node_id: NativeNodeId, count: u32, ) -> NativeResult<FileOffset>

Allocate adjacency space for outgoing edges

Source

pub fn allocate_incoming_adjacency( &mut self, node_id: NativeNodeId, count: u32, ) -> NativeResult<FileOffset>

Allocate adjacency space for incoming edges

Auto Trait Implementations§

§

impl<'a> Freeze for EdgeStore<'a>

§

impl<'a> RefUnwindSafe for EdgeStore<'a>

§

impl<'a> Send for EdgeStore<'a>

§

impl<'a> Sync for EdgeStore<'a>

§

impl<'a> Unpin for EdgeStore<'a>

§

impl<'a> !UnwindSafe for EdgeStore<'a>

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V