Trait indradb::Transaction[][src]

pub trait Transaction {
    fn create_vertex(&self, vertex: &Vertex) -> Result<bool>;
fn get_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<Vec<Vertex>>;
fn delete_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<()>;
fn get_vertex_count(&self) -> Result<u64>;
fn create_edge(&self, key: &EdgeKey) -> Result<bool>;
fn get_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<Vec<Edge>>;
fn delete_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<()>;
fn get_edge_count(
        &self,
        id: Uuid,
        t: Option<&Type>,
        direction: EdgeDirection
    ) -> Result<u64>;
fn get_vertex_properties(
        &self,
        q: VertexPropertyQuery
    ) -> Result<Vec<VertexProperty>>;
fn get_all_vertex_properties<Q: Into<VertexQuery>>(
        &self,
        q: Q
    ) -> Result<Vec<VertexProperties>>;
fn set_vertex_properties(
        &self,
        q: VertexPropertyQuery,
        value: &JsonValue
    ) -> Result<()>;
fn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>;
fn get_edge_properties(
        &self,
        q: EdgePropertyQuery
    ) -> Result<Vec<EdgeProperty>>;
fn get_all_edge_properties<Q: Into<EdgeQuery>>(
        &self,
        q: Q
    ) -> Result<Vec<EdgeProperties>>;
fn set_edge_properties(
        &self,
        q: EdgePropertyQuery,
        value: &JsonValue
    ) -> Result<()>;
fn delete_edge_properties(&self, q: EdgePropertyQuery) -> Result<()>; fn create_vertex_from_type(&self, t: Type) -> Result<Uuid> { ... } }

Specifies a transaction implementation, which are provided by datastores.

All datastore manipulations are done through transactions. 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.

Required methods

fn create_vertex(&self, vertex: &Vertex) -> Result<bool>[src]

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.

fn get_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<Vec<Vertex>>[src]

Gets a range of vertices specified by a query.

Arguments

  • q: The query to run.

fn delete_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<()>[src]

Deletes existing vertices specified by a query.

Arguments

  • q: The query to run.

fn get_vertex_count(&self) -> Result<u64>[src]

Gets the number of vertices in the datastore.

fn create_edge(&self, key: &EdgeKey) -> Result<bool>[src]

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.

fn get_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<Vec<Edge>>[src]

Gets a range of edges specified by a query.

Arguments

  • q: The query to run.

fn delete_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<()>[src]

Deletes a set of edges specified by a query.

Arguments

  • q: The query to run.

fn get_edge_count(
    &self,
    id: Uuid,
    t: Option<&Type>,
    direction: EdgeDirection
) -> Result<u64>
[src]

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.

fn get_vertex_properties(
    &self,
    q: VertexPropertyQuery
) -> Result<Vec<VertexProperty>>
[src]

Gets vertex properties.

Arguments

  • q: The query to run.

fn get_all_vertex_properties<Q: Into<VertexQuery>>(
    &self,
    q: Q
) -> Result<Vec<VertexProperties>>
[src]

Gets all vertex properties.

Arguments

  • q: The query to run.

fn set_vertex_properties(
    &self,
    q: VertexPropertyQuery,
    value: &JsonValue
) -> Result<()>
[src]

Sets a vertex properties.

Arguments

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

fn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>[src]

Deletes vertex properties.

Arguments

  • q: The query to run.

fn get_edge_properties(&self, q: EdgePropertyQuery) -> Result<Vec<EdgeProperty>>[src]

Gets edge properties.

Arguments

  • q: The query to run.

fn get_all_edge_properties<Q: Into<EdgeQuery>>(
    &self,
    q: Q
) -> Result<Vec<EdgeProperties>>
[src]

Gets all edge properties.

Arguments

  • q: The query to run.

fn set_edge_properties(
    &self,
    q: EdgePropertyQuery,
    value: &JsonValue
) -> Result<()>
[src]

Sets edge properties.

Arguments

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

fn delete_edge_properties(&self, q: EdgePropertyQuery) -> Result<()>[src]

Deletes edge properties.

Arguments

  • q: The query to run.
Loading content...

Provided methods

fn create_vertex_from_type(&self, t: Type) -> Result<Uuid>[src]

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.
Loading content...

Implementors

impl Transaction for MemoryTransaction[src]

Loading content...