Trait indradb::Transaction
source · pub trait Transaction {
Show 15 methods
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 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 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> { ... }
}
Expand description
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
sourcefn create_vertex(&self, vertex: &Vertex) -> Result<bool>
fn create_vertex(&self, vertex: &Vertex) -> Result<bool>
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.
sourcefn get_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<Vec<Vertex>>
fn get_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<Vec<Vertex>>
sourcefn delete_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<()>
fn delete_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<()>
sourcefn get_vertex_count(&self) -> Result<u64>
fn get_vertex_count(&self) -> Result<u64>
Gets the number of vertices in the datastore..
sourcefn create_edge(&self, key: &EdgeKey) -> Result<bool>
fn create_edge(&self, key: &EdgeKey) -> Result<bool>
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.
sourcefn get_edge_count(
&self,
id: Uuid,
t: Option<&Type>,
direction: EdgeDirection
) -> Result<u64>
fn get_edge_count(
&self,
id: Uuid,
t: Option<&Type>,
direction: EdgeDirection
) -> Result<u64>
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.
sourcefn get_vertex_properties(
&self,
q: VertexPropertyQuery
) -> Result<Vec<VertexProperty>>
fn get_vertex_properties(
&self,
q: VertexPropertyQuery
) -> Result<Vec<VertexProperty>>
sourcefn set_vertex_properties(
&self,
q: VertexPropertyQuery,
value: &JsonValue
) -> Result<()>
fn set_vertex_properties(
&self,
q: VertexPropertyQuery,
value: &JsonValue
) -> Result<()>
Sets a vertex properties.
Arguments
q
- The query to run.name
- The property name.value
- The property value.
sourcefn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>
fn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>
sourcefn get_edge_properties(&self, q: EdgePropertyQuery) -> Result<Vec<EdgeProperty>>
fn get_edge_properties(&self, q: EdgePropertyQuery) -> Result<Vec<EdgeProperty>>
sourcefn set_edge_properties(
&self,
q: EdgePropertyQuery,
value: &JsonValue
) -> Result<()>
fn set_edge_properties(
&self,
q: EdgePropertyQuery,
value: &JsonValue
) -> Result<()>
Sets edge properties.
Arguments
q
- The query to run.name
- The property name.value
- The property value.