EdgeIdManager

Struct EdgeIdManager 

Source
pub struct EdgeIdManager<'a> { /* private fields */ }
Expand description

Edge ID manager for allocating and managing edge identifiers

Implementations§

Source§

impl<'a> EdgeIdManager<'a>

Source

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

Create a new edge ID manager

§Arguments
  • graph_file - Mutable reference to the graph file
Source

pub fn max_edge_id(&self) -> NativeEdgeId

Get the maximum valid edge ID

Returns the highest edge ID that has been allocated.

§Returns

The maximum edge ID as a NativeEdgeId

Source

pub fn allocate_edge_id(&mut self) -> NativeEdgeId

Allocate a new edge ID

Allocates the next available edge ID and updates the persistent header.

§Returns

The newly allocated edge ID

§Panics

Will panic if the edge ID counter overflows

Source

pub fn validate_edge_id(&self, edge_id: NativeEdgeId) -> NativeResult<()>

Validate an edge ID

Checks if the given edge ID is valid (within the allocated range).

§Arguments
  • edge_id - The edge ID to validate
§Returns

Ok(()) if the ID is valid, Err with details if invalid

Source

pub fn edge_count(&self) -> u64

Get the total number of allocated edges

§Returns

The total count of allocated edge IDs

Source

pub fn has_edges(&self) -> bool

Check if any edge IDs have been allocated

§Returns

true if at least one edge ID has been allocated

Source

pub unsafe fn reset_edge_ids(&mut self)

Reset all edge IDs (for testing only)

This function resets the edge ID counter to zero. It should only be used in test environments with caution.

§Safety

This will invalidate all existing edge IDs and should only be used in controlled test scenarios.

Source§

impl<'a> EdgeIdManager<'a>

Source

pub fn get_statistics(&self) -> EdgeStatistics

Get edge statistics

§Returns

Comprehensive edge statistics including total count and max ID

Source

pub fn is_efficient_utilization(&self) -> bool

Check if edge IDs are efficiently utilized

Returns true if the ratio of allocated IDs to total edges is reasonable. This helps detect potential gaps in ID allocation.

§Returns

true if ID utilization is efficient (>= 80%), false otherwise

Source

pub fn calculate_fragmentation(&self) -> f64

Calculate edge ID fragmentation

Returns the percentage of unused edge IDs within the allocated range.

§Returns

Fragmentation percentage (0.0 to 1.0)

Auto Trait Implementations§

§

impl<'a> Freeze for EdgeIdManager<'a>

§

impl<'a> RefUnwindSafe for EdgeIdManager<'a>

§

impl<'a> Send for EdgeIdManager<'a>

§

impl<'a> Sync for EdgeIdManager<'a>

§

impl<'a> Unpin for EdgeIdManager<'a>

§

impl<'a> !UnwindSafe for EdgeIdManager<'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