pub struct SharedGraph<N: Copy + Default + 'static, E: Copy + Default + 'static> { /* private fields */ }Implementations§
pub fn create( base_path: impl AsRef<Path>, max_nodes: usize, max_edges: usize, ) -> Result<Self, GraphError>
pub fn open( base_path: impl AsRef<Path>, max_nodes: usize, max_edges: usize, ) -> Result<Self, GraphError>
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn max_nodes(&self) -> usize
pub fn max_edges(&self) -> usize
Sourcepub fn add_node(&self, value: N) -> Result<NodeIndex<N>, GraphError>
pub fn add_node(&self, value: N) -> Result<NodeIndex<N>, GraphError>
Add a new node with value. Returns its index.
Sourcepub fn add_edge(
&self,
src: NodeIndex<N>,
dst: NodeIndex<N>,
value: E,
) -> Result<EdgeIndex<E>, GraphError>
pub fn add_edge( &self, src: NodeIndex<N>, dst: NodeIndex<N>, value: E, ) -> Result<EdgeIndex<E>, GraphError>
Add an edge from src to dst carrying value. Returns
its index. Single-writer per src node (the linked-list head
update isn’t synchronised internally).
Sourcepub fn node_value(&self, idx: NodeIndex<N>) -> Option<N>
pub fn node_value(&self, idx: NodeIndex<N>) -> Option<N>
Read the value at a node index.
Sourcepub fn edge_endpoints(&self, idx: EdgeIndex<E>) -> Option<(E, NodeIndex<N>)>
pub fn edge_endpoints(&self, idx: EdgeIndex<E>) -> Option<(E, NodeIndex<N>)>
Read the (value, dst) for an edge index.
Sourcepub fn out_degree(&self, src: NodeIndex<N>) -> Option<u32>
pub fn out_degree(&self, src: NodeIndex<N>) -> Option<u32>
Out-degree of a node.
Sourcepub fn neighbors(
&self,
src: NodeIndex<N>,
) -> Vec<(EdgeIndex<E>, NodeIndex<N>, E)>
pub fn neighbors( &self, src: NodeIndex<N>, ) -> Vec<(EdgeIndex<E>, NodeIndex<N>, E)>
Enumerate outgoing edges from src as (EdgeIndex, dst, edge_value).
Snapshot at call time; not stable under concurrent writes to src.
Sourcepub fn remove_edge(
&self,
src: NodeIndex<N>,
edge_idx: EdgeIndex<E>,
) -> Option<E>
pub fn remove_edge( &self, src: NodeIndex<N>, edge_idx: EdgeIndex<E>, ) -> Option<E>
Remove an edge from src’s out-list. Returns the removed
edge’s value if found.
pub fn flush(&self) -> Result<(), GraphError>
pub fn flush_async(&self) -> Result<(), GraphError>
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more