Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore: Send + Sync {
    // Required methods
    fn upsert_node<'life0, 'async_trait>(
        &'life0 self,
        node: Node,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_edge<'life0, 'async_trait>(
        &'life0 self,
        edge: Edge,
    ) -> Pin<Box<dyn Future<Output = Result<EdgeId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_node<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NodeId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Node>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_edge<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 EdgeId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Edge>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn nodes_by_label<'life0, 'life1, 'async_trait>(
        &'life0 self,
        label: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn edges_from<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 NodeId,
        label: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Edge>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn edges_to<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        to: &'life1 NodeId,
        label: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Edge>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(usize, usize)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Storage abstraction. Concrete implementations: InMemoryGraph.

Required Methods§

Source

fn upsert_node<'life0, 'async_trait>( &'life0 self, node: Node, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Insert / replace a node by id.

Source

fn add_edge<'life0, 'async_trait>( &'life0 self, edge: Edge, ) -> Pin<Box<dyn Future<Output = Result<EdgeId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Insert an edge.

Source

fn get_node<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NodeId, ) -> Pin<Box<dyn Future<Output = Result<Option<Node>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up a node by id.

Source

fn get_edge<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 EdgeId, ) -> Pin<Box<dyn Future<Output = Result<Option<Edge>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up an edge by id.

Source

fn nodes_by_label<'life0, 'life1, 'async_trait>( &'life0 self, label: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

All nodes carrying any of labels.

Source

fn edges_from<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 NodeId, label: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Edge>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

All edges leaving from (optionally filtered by label).

Source

fn edges_to<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, to: &'life1 NodeId, label: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Edge>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

All edges entering to (optionally filtered by label).

Source

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(usize, usize)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Counts.

Implementors§