Trait Transaction

Source
pub trait Transaction<'a> {
Show 28 methods // Required methods fn vertex_count(&self) -> u64; fn all_vertices(&'a self) -> Result<DynIter<'a, Vertex>>; fn range_vertices(&'a self, offset: Uuid) -> Result<DynIter<'a, Vertex>>; fn specific_vertices( &'a self, ids: Vec<Uuid>, ) -> Result<DynIter<'a, Vertex>>; fn vertex_ids_with_property( &'a self, name: Identifier, ) -> Result<Option<DynIter<'a, Uuid>>>; fn vertex_ids_with_property_value( &'a self, name: Identifier, value: &Json, ) -> Result<Option<DynIter<'a, Uuid>>>; fn edge_count(&self) -> u64; fn all_edges(&'a self) -> Result<DynIter<'a, Edge>>; fn range_edges(&'a self, offset: Edge) -> Result<DynIter<'a, Edge>>; fn range_reversed_edges(&'a self, offset: Edge) -> Result<DynIter<'a, Edge>>; fn specific_edges(&'a self, edges: Vec<Edge>) -> Result<DynIter<'a, Edge>>; fn edges_with_property( &'a self, name: Identifier, ) -> Result<Option<DynIter<'a, Edge>>>; fn edges_with_property_value( &'a self, name: Identifier, value: &Json, ) -> Result<Option<DynIter<'a, Edge>>>; fn vertex_property( &self, vertex: &Vertex, name: Identifier, ) -> Result<Option<Json>>; fn all_vertex_properties_for_vertex( &'a self, vertex: &Vertex, ) -> Result<DynIter<'a, (Identifier, Json)>>; fn edge_property( &self, edge: &Edge, name: Identifier, ) -> Result<Option<Json>>; fn all_edge_properties_for_edge( &'a self, edge: &Edge, ) -> Result<DynIter<'a, (Identifier, Json)>>; fn delete_vertices(&mut self, vertices: Vec<Vertex>) -> Result<()>; fn delete_edges(&mut self, edges: Vec<Edge>) -> Result<()>; fn delete_vertex_properties( &mut self, props: Vec<(Uuid, Identifier)>, ) -> Result<()>; fn delete_edge_properties( &mut self, props: Vec<(Edge, Identifier)>, ) -> Result<()>; fn create_vertex(&mut self, vertex: &Vertex) -> Result<bool>; fn create_edge(&mut self, edge: &Edge) -> Result<bool>; fn index_property(&mut self, name: Identifier) -> Result<()>; fn set_vertex_properties( &mut self, vertices: Vec<Uuid>, name: Identifier, value: &Json, ) -> Result<()>; fn set_edge_properties( &mut self, edges: Vec<Edge>, name: Identifier, value: &Json, ) -> Result<()>; // Provided methods fn sync(&self) -> Result<()> { ... } fn bulk_insert(&mut self, items: Vec<BulkInsertItem>) -> Result<()> { ... }
}
Expand description

Specifies a datastore transaction, which contains nearly all of the datastore implementation-specific logic.

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

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

Required Methods§

Source

fn vertex_count(&self) -> u64

Gets the number of vertices.

Source

fn all_vertices(&'a self) -> Result<DynIter<'a, Vertex>>

Returns all vertices.

Source

fn range_vertices(&'a self, offset: Uuid) -> Result<DynIter<'a, Vertex>>

Returns all vertices with id >= offset.

§Arguments
  • offset - Only fetch vertices with an offset greater than or equal to this value.
Source

fn specific_vertices(&'a self, ids: Vec<Uuid>) -> Result<DynIter<'a, Vertex>>

Gets a specific set of vertices with the given IDs.

Source

fn vertex_ids_with_property( &'a self, name: Identifier, ) -> Result<Option<DynIter<'a, Uuid>>>

Get all vertices with a given property.

§Arguments
  • name - The property name.
Source

fn vertex_ids_with_property_value( &'a self, name: Identifier, value: &Json, ) -> Result<Option<DynIter<'a, Uuid>>>

Get all vertices with a given property value.

§Arguments
  • name - The property name.
  • value - The property value.
Source

fn edge_count(&self) -> u64

Gets the number of edges.

Source

fn all_edges(&'a self) -> Result<DynIter<'a, Edge>>

Returns all edges.

Source

fn range_edges(&'a self, offset: Edge) -> Result<DynIter<'a, Edge>>

Returns all edges with that are greater than or equal to offset.

§Arguments
  • offset - Only fetch edges greater than or equal to this value.
Source

fn range_reversed_edges(&'a self, offset: Edge) -> Result<DynIter<'a, Edge>>

Returns all reversed edges (where the outbound and inbound IDs are reversed from their actual values) that are greater than or equal to offset.

§Arguments
  • offset - Only fetch edges greater than or equal to this value.
Source

fn specific_edges(&'a self, edges: Vec<Edge>) -> Result<DynIter<'a, Edge>>

Gets a specific set of edges.

§Arguments
  • edges - The edges to get.
Source

fn edges_with_property( &'a self, name: Identifier, ) -> Result<Option<DynIter<'a, Edge>>>

Get all edges with a given property.

§Arguments
  • name - The property name.
Source

fn edges_with_property_value( &'a self, name: Identifier, value: &Json, ) -> Result<Option<DynIter<'a, Edge>>>

Get all edges with a given property value.

§Arguments
  • name - The property name.
  • value - The property value.
Source

fn vertex_property( &self, vertex: &Vertex, name: Identifier, ) -> Result<Option<Json>>

Gets the value of a vertex property if it exists, or None otherwise.

§Arguments
  • vertex - The vertex.
  • name - The property name.
Source

fn all_vertex_properties_for_vertex( &'a self, vertex: &Vertex, ) -> Result<DynIter<'a, (Identifier, Json)>>

Gets all vertex properties for a given vertex.

§Arguments
  • vertex - The vertex.
Source

fn edge_property(&self, edge: &Edge, name: Identifier) -> Result<Option<Json>>

Gets the value of an edge property if it exists, or None otherwise.

§Arguments
  • edge - The edge.
  • name - The property name.
Source

fn all_edge_properties_for_edge( &'a self, edge: &Edge, ) -> Result<DynIter<'a, (Identifier, Json)>>

Gets all edge properties for a given edges.

§Arguments
  • edge - The edge.
Source

fn delete_vertices(&mut self, vertices: Vec<Vertex>) -> Result<()>

Deletes the given vertices.

§Arguments
  • vertices - The vertices to delete.
Source

fn delete_edges(&mut self, edges: Vec<Edge>) -> Result<()>

Deletes the given edges.

§Arguments
  • edges - The edges to delete.
Source

fn delete_vertex_properties( &mut self, props: Vec<(Uuid, Identifier)>, ) -> Result<()>

Deletes the given vertex properties.

§Arguments
  • props - The vertex properties to delete.
Source

fn delete_edge_properties( &mut self, props: Vec<(Edge, Identifier)>, ) -> Result<()>

Deletes the given edge properties.

§Arguments
  • props - The edge properties to delete.
Source

fn create_vertex(&mut 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.
Source

fn create_edge(&mut self, edge: &Edge) -> Result<bool>

Creates a new edge. Returns whether the edge was successfully created - if this is false, it’s because one of the specified vertices is missing.

§Arguments
  • edge: The edge to create.
Source

fn index_property(&mut self, name: Identifier) -> Result<()>

Enables indexing on a specified property. When indexing is enabled on a property, it’s possible to query on its presence and values.

§Arguments
  • name: The name of the property to index.
Source

fn set_vertex_properties( &mut self, vertices: Vec<Uuid>, name: Identifier, value: &Json, ) -> Result<()>

Sets vertex properties.

§Arguments
  • vertices: The vertices to set the properties on.
  • name: The property name.
  • value: The property value.
Source

fn set_edge_properties( &mut self, edges: Vec<Edge>, name: Identifier, value: &Json, ) -> Result<()>

Sets edge properties.

§Arguments
  • edges: The edges to set the properties on.
  • name: The property name.
  • value: The property value.

Provided Methods§

Source

fn sync(&self) -> Result<()>

Syncs persisted content. By default, this errors out, but this can be overridden in datastores that support syncing.

Source

fn bulk_insert(&mut self, items: Vec<BulkInsertItem>) -> Result<()>

Bulk inserts many vertices, edges, and/or properties. By default, this makes the underlying calls to insert the values, but can be overridden to offer a more efficient implementation.

§Arguments
  • items: The items to insert.

Implementors§