Skip to main content

GraphDB

Trait GraphDB 

Source
pub trait GraphDB: Send + Sync {
    // Required methods
    fn add_vertex<'life0, 'async_trait>(
        &'life0 self,
        vertex: Vertex,
    ) -> Pin<Box<dyn Future<Output = Result<Vertex, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_vertex<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 VertexId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vertex>, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_vertex<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 VertexId,
        properties: Properties,
    ) -> Pin<Box<dyn Future<Output = Result<Vertex, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_vertex<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 VertexId,
    ) -> Pin<Box<dyn Future<Output = Result<(), GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_edge<'life0, 'async_trait>(
        &'life0 self,
        edge: Edge,
    ) -> Pin<Box<dyn Future<Output = Result<Edge, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn traverse<'life0, 'async_trait>(
        &'life0 self,
        traversal: Traversal,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PathResult>, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        params: Option<Params>,
    ) -> Pin<Box<dyn Future<Output = Result<QueryResult, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A generic async graph database trait.

Backends such as Neo4j, NebulaGraph, or ArangoDB can implement this to provide vertex/edge CRUD, traversals, and arbitrary query execution.

Required Methods§

Source

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

Insert a new vertex. The id field may be assigned by the caller or left empty for the backend to generate.

Source

fn get_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<Option<Vertex>, GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the vertex identified by id.

Source

fn update_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, properties: Properties, ) -> Pin<Box<dyn Future<Output = Result<Vertex, GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update properties of an existing vertex. The provided properties are merged into (not fully replaced by) the existing ones.

Source

fn delete_vertex<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 VertexId, ) -> Pin<Box<dyn Future<Output = Result<(), GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete the vertex identified by id and all incident edges.

Source

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

Insert a new edge.

Source

fn traverse<'life0, 'async_trait>( &'life0 self, traversal: Traversal, ) -> Pin<Box<dyn Future<Output = Result<Vec<PathResult>, GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Traverse the graph starting from traversal.start.

Source

fn query<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, params: Option<Params>, ) -> Pin<Box<dyn Future<Output = Result<QueryResult, GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an arbitrary backend-specific query with optional parameters.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§