TraversalService

Trait TraversalService 

Source
pub trait TraversalService:
    Send
    + Sync
    + 'static {
    type TraverseStream: Stream<Item = Result<Node, Status>> + Send + 'static;

    // Required methods
    fn get_node<'life0, 'async_trait>(
        &'life0 self,
        request: Request<GetNodeRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Node>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn traverse<'life0, 'async_trait>(
        &'life0 self,
        request: Request<TraversalRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::TraverseStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_path_to<'life0, 'async_trait>(
        &'life0 self,
        request: Request<FindPathToRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Path>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_path_between<'life0, 'async_trait>(
        &'life0 self,
        request: Request<FindPathBetweenRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Path>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_nodes<'life0, 'async_trait>(
        &'life0 self,
        request: Request<TraversalRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<CountResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_edges<'life0, 'async_trait>(
        &'life0 self,
        request: Request<TraversalRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<CountResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stats<'life0, 'async_trait>(
        &'life0 self,
        request: Request<StatsRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<StatsResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with TraversalServiceServer.

Required Associated Types§

Source

type TraverseStream: Stream<Item = Result<Node, Status>> + Send + 'static

Server streaming response type for the Traverse method.

Required Methods§

Source

fn get_node<'life0, 'async_trait>( &'life0 self, request: Request<GetNodeRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Node>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetNode returns a single Node and its properties.

Source

fn traverse<'life0, 'async_trait>( &'life0 self, request: Request<TraversalRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::TraverseStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Traverse performs a breadth-first graph traversal from a set of source nodes, then streams the nodes it encounters (if they match a given return filter), along with their properties.

Source

fn find_path_to<'life0, 'async_trait>( &'life0 self, request: Request<FindPathToRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Path>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

FindPathTo searches for a shortest path between a set of source nodes and a node that matches a specific criteria.

It does so by performing a breadth-first search from the source node, until any node that matches the given criteria is found, then follows back its parents to return a shortest path from the source set to that node.

Source

fn find_path_between<'life0, 'async_trait>( &'life0 self, request: Request<FindPathBetweenRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Path>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

FindPathBetween searches for a shortest path between a set of source nodes and a set of destination nodes.

It does so by performing a bidirectional breadth-first search, i.e., two parallel breadth-first searches, one from the source set (“src-BFS”) and one from the destination set (“dst-BFS”), until both searches find a common node that joins their visited sets. This node is called the “midpoint node”. The path returned is the path src -> … -> midpoint -> … -> dst, which is always a shortest path between src and dst.

The graph direction of both BFS can be configured separately. By default, the dst-BFS will use the graph in the opposite direction than the src-BFS (if direction = FORWARD, by default direction_reverse = BACKWARD, and vice-versa). The default behavior is thus to search for a shortest path between two nodes in a given direction. However, one can also specify FORWARD or BACKWARD for both the src-BFS and the dst-BFS. This will search for a common descendant or a common ancestor between the two sets, respectively. These will be the midpoints of the returned path.

Source

fn count_nodes<'life0, 'async_trait>( &'life0 self, request: Request<TraversalRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<CountResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CountNodes does the same as Traverse, but only returns the number of nodes accessed during the traversal.

Source

fn count_edges<'life0, 'async_trait>( &'life0 self, request: Request<TraversalRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<CountResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CountEdges does the same as Traverse, but only returns the number of edges accessed during the traversal.

Source

fn stats<'life0, 'async_trait>( &'life0 self, request: Request<StatsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<StatsResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stats returns various statistics on the overall graph.

Implementors§