Trait indradb::Datastore

source ·
pub trait Datastore {
Show 21 methods fn create_vertex(&self, vertex: &Vertex) -> Result<bool>; fn get_vertices(&self, q: VertexQuery) -> Result<Vec<Vertex>>; fn delete_vertices(&self, q: VertexQuery) -> Result<()>; fn get_vertex_count(&self) -> Result<u64>; fn create_edge(&self, key: &EdgeKey) -> Result<bool>; fn get_edges(&self, q: EdgeQuery) -> Result<Vec<Edge>>; fn delete_edges(&self, q: EdgeQuery) -> Result<()>; fn get_edge_count(
        &self,
        id: Uuid,
        t: Option<&Identifier>,
        direction: EdgeDirection
    ) -> Result<u64>; fn get_vertex_properties(
        &self,
        q: VertexPropertyQuery
    ) -> Result<Vec<VertexProperty>>; fn get_all_vertex_properties(
        &self,
        q: VertexQuery
    ) -> Result<Vec<VertexProperties>>; fn set_vertex_properties(
        &self,
        q: VertexPropertyQuery,
        value: Value
    ) -> Result<()>; fn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>; fn get_edge_properties(
        &self,
        q: EdgePropertyQuery
    ) -> Result<Vec<EdgeProperty>>; fn get_all_edge_properties(
        &self,
        q: EdgeQuery
    ) -> Result<Vec<EdgeProperties>>; fn set_edge_properties(
        &self,
        q: EdgePropertyQuery,
        value: Value
    ) -> Result<()>; fn delete_edge_properties(&self, q: EdgePropertyQuery) -> Result<()>; fn index_property(&self, name: Identifier) -> Result<()>; fn sync(&self) -> Result<()> { ... } fn transaction(&self) -> Result<Self>
    where
        Self: Sized
, { ... } fn create_vertex_from_type(&self, t: Identifier) -> Result<Uuid> { ... } fn bulk_insert(&self, items: Vec<BulkInsertItem>) -> Result<()> { ... }
}
Expand description

Specifies a datastore implementation.

Note that this trait and its members purposefully do not employ any generic arguments. While that would improve ergonomics, it would remove object safety, which we need for plugins.

Errors

All methods may return an error if something unexpected happens - e.g. if there was a problem connecting to the underlying database.

Required Methods§

Creates a new vertex. Returns whether the vertex was successfully created - if this is false, it’s because a vertex with the same UUID already exists.

Arguments
  • vertex: The vertex to create.

Gets a range of vertices specified by a query.

Arguments
  • q: The query to run.

Deletes existing vertices specified by a query.

Arguments
  • q: The query to run.

Gets the number of vertices in the datastore.

Creates a new edge. If the edge already exists, this will update it with a new update datetime. Returns whether the edge was successfully created - if this is false, it’s because one of the specified vertices is missing.

Arguments
  • key: The edge to create.

Gets a range of edges specified by a query.

Arguments
  • q: The query to run.

Deletes a set of edges specified by a query.

Arguments
  • q: The query to run.

Gets the number of edges associated with a vertex.

Arguments
  • id: The id of the vertex.
  • t: Only get the count for a specified edge type.
  • direction: The direction of edges to get.

Gets vertex properties.

Arguments
  • q: The query to run.

Gets all vertex properties.

Arguments
  • q: The query to run.

Sets a vertex properties.

Arguments
  • q: The query to run.
  • value: The property value.

Deletes vertex properties.

Arguments
  • q: The query to run.

Gets edge properties.

Arguments
  • q: The query to run.

Gets all edge properties.

Arguments
  • q: The query to run.

Sets edge properties.

Arguments
  • q: The query to run.
  • value: The property value.

Deletes edge properties.

Arguments
  • q: The query to run.

Provided Methods§

Syncs persisted content. Depending on the datastore implementation, this has different meanings - including potentially being a no-op.

Creates a new transaction. Some datastore implementations do not support transactional updates, in which case this will return an error.

Creates a new vertex with just a type specification. As opposed to create_vertex, this is used when you do not want to manually specify the vertex’s UUID. Returns the new vertex’s UUID.

Arguments
  • t: The type of the vertex to create.

Bulk inserts many vertices, edges, and/or properties.

Arguments
  • items: The items to insert.

Implementors§