Trait indradb::Transaction [] [src]

pub trait Transaction {
    fn create_vertex(&self, t: &Type) -> Result<Uuid>;
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,
        type_filter: Option<&Type>,
        direction: EdgeDirection
    ) -> Result<u64>;
fn get_global_metadata(&self, name: &str) -> Result<Option<JsonValue>>;
fn set_global_metadata(&self, name: &str, value: &JsonValue) -> Result<()>;
fn delete_global_metadata(&self, name: &str) -> Result<()>;
fn get_vertex_metadata(
        &self,
        q: &VertexQuery,
        name: &str
    ) -> Result<Vec<VertexMetadata>>;
fn set_vertex_metadata(
        &self,
        q: &VertexQuery,
        name: &str,
        value: &JsonValue
    ) -> Result<()>;
fn delete_vertex_metadata(&self, q: &VertexQuery, name: &str) -> Result<()>;
fn get_edge_metadata(
        &self,
        q: &EdgeQuery,
        name: &str
    ) -> Result<Vec<EdgeMetadata>>;
fn set_edge_metadata(
        &self,
        q: &EdgeQuery,
        name: &str,
        value: &JsonValue
    ) -> Result<()>;
fn delete_edge_metadata(&self, q: &EdgeQuery, name: &str) -> Result<()>; }

Specifies a transaction implementation, which are returned by datastores. All datastore manipulations are done through transactions. Despite the name, different datastore implementations carry different guarantees. Depending on the implementation, it may not be possible to rollback the changes on error. See the documentation of individual implementations for details. Transactions are automatically committed on drop. Transactions should be designed to not fail on commit; i.e. errors should occur when a method is actually called instead.

Required Methods

Creates a new vertex.

Arguments

  • t - The type of the vertex.

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.
  • type_filter - Only get the count for a specified edge type.
  • direction: The direction of edges to get.

Gets a global metadata value.

Arguments

  • name - The metadata name.

Errors

Returns Error::MetadataNotFound if the metadata does not exist.

Sets a global metadata value.

Arguments

  • name - The metadata name.
  • value - The metadata value.

Deletes a global metadata value.

Arguments

  • name - The metadata name.

Gets a vertex metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.

Sets a vertex metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.
  • value - The metadata value.

Deletes a vertex metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.

Gets an edge metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.

Sets an edge metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.
  • value - The metadata value.

Deletes an edge metadata value.

Arguments

  • q - The query to run.
  • name - The metadata name.

Implementors