pub struct MobileGraphStore { /* private fields */ }Expand description
In-memory graph store for mobile knowledge graphs.
Implementations§
Source§impl MobileGraphStore
impl MobileGraphStore
Sourcepub fn add_node(&self, node: MobileGraphNode)
pub fn add_node(&self, node: MobileGraphNode)
Adds a node to the graph.
Sourcepub fn add_edge(&self, edge: MobileGraphEdge) -> Result<(), VelesError>
pub fn add_edge(&self, edge: MobileGraphEdge) -> Result<(), VelesError>
Adds an edge to the graph.
§Lock Order
Acquires locks in consistent order: edges → outgoing → incoming WITHOUT dropping between operations to ensure atomicity. This prevents race conditions with concurrent remove_node() calls.
Sourcepub fn get_node(&self, id: u64) -> Option<MobileGraphNode>
pub fn get_node(&self, id: u64) -> Option<MobileGraphNode>
Gets a node by ID.
Sourcepub fn get_edge(&self, id: u64) -> Option<MobileGraphEdge>
pub fn get_edge(&self, id: u64) -> Option<MobileGraphEdge>
Gets an edge by ID.
Sourcepub fn node_count(&self) -> u64
pub fn node_count(&self) -> u64
Returns the number of nodes.
Sourcepub fn edge_count(&self) -> u64
pub fn edge_count(&self) -> u64
Returns the number of edges.
Sourcepub fn get_outgoing(&self, node_id: u64) -> Vec<MobileGraphEdge>
pub fn get_outgoing(&self, node_id: u64) -> Vec<MobileGraphEdge>
Gets outgoing edges from a node.
§Lock Order
Acquires locks in consistent order: edges → outgoing to prevent ABBA deadlock with write operations.
Sourcepub fn get_incoming(&self, node_id: u64) -> Vec<MobileGraphEdge>
pub fn get_incoming(&self, node_id: u64) -> Vec<MobileGraphEdge>
Gets incoming edges to a node.
§Lock Order
Acquires locks in consistent order: edges → incoming to prevent ABBA deadlock with write operations.
Sourcepub fn get_outgoing_by_label(
&self,
node_id: u64,
label: String,
) -> Vec<MobileGraphEdge>
pub fn get_outgoing_by_label( &self, node_id: u64, label: String, ) -> Vec<MobileGraphEdge>
Gets outgoing edges filtered by label.
Sourcepub fn get_neighbors(&self, node_id: u64) -> Vec<u64>
pub fn get_neighbors(&self, node_id: u64) -> Vec<u64>
Gets neighbors reachable from a node (1-hop).
Sourcepub fn bfs_traverse(
&self,
source_id: u64,
max_depth: u32,
limit: u32,
) -> Vec<TraversalResult>
pub fn bfs_traverse( &self, source_id: u64, max_depth: u32, limit: u32, ) -> Vec<TraversalResult>
Performs BFS traversal from a source node.
§Arguments
source_id- Starting node IDmax_depth- Maximum traversal depthlimit- Maximum number of results
Sourcepub fn remove_node(&self, node_id: u64)
pub fn remove_node(&self, node_id: u64)
Removes a node and all connected edges.
§Lock Order
Acquires locks in consistent order: edges → outgoing → incoming → nodes to prevent deadlock with concurrent add_edge() calls.
Sourcepub fn remove_edge(&self, edge_id: u64)
pub fn remove_edge(&self, edge_id: u64)
Removes an edge by ID.
§Lock Order
Acquires locks in consistent order: edges → outgoing → incoming WITHOUT dropping between operations to ensure atomicity.
Sourcepub fn clear(&self)
pub fn clear(&self)
Clears all nodes and edges.
§Lock Order
Acquires locks in consistent order: edges → outgoing → incoming → nodes
Sourcepub fn dfs_traverse(
&self,
source_id: u64,
max_depth: u32,
limit: u32,
) -> Vec<TraversalResult>
pub fn dfs_traverse( &self, source_id: u64, max_depth: u32, limit: u32, ) -> Vec<TraversalResult>
Performs DFS traversal from a source node.
§Arguments
source_id- Starting node IDmax_depth- Maximum traversal depthlimit- Maximum number of results
Sourcepub fn out_degree(&self, node_id: u64) -> u32
pub fn out_degree(&self, node_id: u64) -> u32
Gets the out-degree (number of outgoing edges) of a node.
Sourcepub fn in_degree(&self, node_id: u64) -> u32
pub fn in_degree(&self, node_id: u64) -> u32
Gets the in-degree (number of incoming edges) of a node.
Sourcepub fn get_nodes_by_label(&self, label: String) -> Vec<MobileGraphNode>
pub fn get_nodes_by_label(&self, label: String) -> Vec<MobileGraphNode>
Gets all nodes with a specific label.
Sourcepub fn get_edges_by_label(&self, label: String) -> Vec<MobileGraphEdge>
pub fn get_edges_by_label(&self, label: String) -> Vec<MobileGraphEdge>
Gets all edges with a specific label.
Trait Implementations§
Source§impl Default for MobileGraphStore
impl Default for MobileGraphStore
Source§impl<UT> LiftRef<UT> for MobileGraphStore
impl<UT> LiftRef<UT> for MobileGraphStore
type LiftType = Arc<MobileGraphStore>
Source§impl<UT> LowerError<UT> for MobileGraphStore
impl<UT> LowerError<UT> for MobileGraphStore
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for MobileGraphStore
impl<UT> LowerReturn<UT> for MobileGraphStore
Source§type ReturnType = <Arc<MobileGraphStore> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<MobileGraphStore> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for MobileGraphStore
impl<UT> TypeId<UT> for MobileGraphStore
Auto Trait Implementations§
impl !Freeze for MobileGraphStore
impl RefUnwindSafe for MobileGraphStore
impl Send for MobileGraphStore
impl Sync for MobileGraphStore
impl Unpin for MobileGraphStore
impl UnsafeUnpin for MobileGraphStore
impl UnwindSafe for MobileGraphStore
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
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);