pub struct SQLiteGraphStore { /* private fields */ }Expand description
Direct durable access to a standalone graph table family.
Implementations§
Source§impl SQLiteGraphStore
impl SQLiteGraphStore
Sourcepub fn open(
conn: ManagedConnection,
table_name: Option<&str>,
) -> Result<Self, SQLiteError>
pub fn open( conn: ManagedConnection, table_name: Option<&str>, ) -> Result<Self, SQLiteError>
Open a table family and migrate small access metadata once. Existing records are streamed only for a legacy label-watermark migration.
Sourcepub fn read_snapshot<T>(
&self,
read: impl FnOnce(&PersistentGraphStore) -> GraphStoreResult<T>,
) -> GraphStoreResult<T>
pub fn read_snapshot<T>( &self, read: impl FnOnce(&PersistentGraphStore) -> GraphStoreResult<T>, ) -> GraphStoreResult<T>
Execute several graph reads against one pinned physical snapshot. Callers must serialize transaction ownership on this storage session.
Sourcepub fn as_graph_store(&self) -> &PersistentGraphStore
pub fn as_graph_store(&self) -> &PersistentGraphStore
Borrow the durable handle within an existing storage transaction.
pub fn create_graph(&mut self, name: &str) -> Result<(), SQLiteError>
pub fn drop_graph(&mut self, name: &str) -> Result<(), SQLiteError>
pub fn graph_names(&self) -> Result<Vec<String>, SQLiteError>
pub fn has_graph(&self, name: &str) -> Result<bool, SQLiteError>
pub fn union_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> Result<(), SQLiteError>
pub fn intersect_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> Result<(), SQLiteError>
pub fn difference_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> Result<(), SQLiteError>
pub fn copy_graph( &mut self, source: &str, target: &str, ) -> Result<(), SQLiteError>
pub fn add_vertex( &mut self, vertex: Vertex, graph: &str, ) -> Result<(), SQLiteError>
pub fn add_edge(&mut self, edge: Edge, graph: &str) -> Result<(), SQLiteError>
pub fn remove_vertex( &mut self, vertex_id: u64, graph: &str, ) -> Result<(), SQLiteError>
pub fn remove_edge( &mut self, edge_id: u64, graph: &str, ) -> Result<(), SQLiteError>
pub fn neighbors( &self, vertex_id: u64, label: Option<&str>, direction: Direction, graph: &str, ) -> Result<Vec<u64>, SQLiteError>
pub fn vertices_by_label( &self, label: &str, graph: &str, ) -> Result<Vec<Vertex>, SQLiteError>
pub fn vertex_ids_by_label( &self, label: &str, graph: &str, ) -> Result<Vec<u64>, SQLiteError>
pub fn vertices_in_graph(&self, graph: &str) -> Result<Vec<Vertex>, SQLiteError>
pub fn edges_in_graph(&self, graph: &str) -> Result<Vec<Edge>, SQLiteError>
pub fn vertex_graphs( &self, vertex_id: u64, ) -> Result<BTreeSet<String>, SQLiteError>
pub fn out_edge_ids( &self, vertex_id: u64, graph: &str, ) -> Result<BTreeSet<u64>, SQLiteError>
pub fn in_edge_ids( &self, vertex_id: u64, graph: &str, ) -> Result<BTreeSet<u64>, SQLiteError>
pub fn edge_ids_by_label( &self, label: &str, graph: &str, ) -> Result<BTreeSet<u64>, SQLiteError>
pub fn vertex_ids_in_graph( &self, graph: &str, ) -> Result<BTreeSet<u64>, SQLiteError>
pub fn require_vertex_in_graph( &self, vertex_id: u64, graph: &str, ) -> Result<(), SQLiteError>
pub fn degree_distribution( &self, graph: &str, ) -> Result<BTreeMap<u64, u64>, SQLiteError>
pub fn label_degree(&self, label: &str, graph: &str) -> Result<f64, SQLiteError>
pub fn vertex_label_counts( &self, graph: &str, ) -> Result<BTreeMap<String, u64>, SQLiteError>
pub fn get_vertex(&self, vertex_id: u64) -> Result<Option<Vertex>, SQLiteError>
pub fn get_edge(&self, edge_id: u64) -> Result<Option<Edge>, SQLiteError>
pub fn next_vertex_id(&mut self) -> Result<u64, SQLiteError>
pub fn next_edge_id(&mut self) -> Result<u64, SQLiteError>
pub fn allocate_vertex_id( &mut self, label: &str, graph: &str, ) -> Result<u64, SQLiteError>
pub fn allocate_edge_id( &mut self, label: &str, graph: &str, ) -> Result<u64, SQLiteError>
pub fn clear(&mut self) -> Result<(), SQLiteError>
pub fn vertices(&self) -> Result<BTreeMap<u64, Vertex>, SQLiteError>
pub fn edges(&self) -> Result<BTreeMap<u64, Edge>, SQLiteError>
Trait Implementations§
Source§impl GraphStore for SQLiteGraphStore
impl GraphStore for SQLiteGraphStore
Source§fn vertex_id_page(
&self,
graph: &str,
after: Option<u64>,
limit: usize,
) -> GraphStoreResult<Vec<u64>>
fn vertex_id_page( &self, graph: &str, after: Option<u64>, limit: usize, ) -> GraphStoreResult<Vec<u64>>
Bounded ascending vertex identities, exclusively after the cursor.
Durable stores override this with an indexed storage cursor.
Source§fn edge_id_page(
&self,
graph: &str,
after: Option<u64>,
limit: usize,
) -> GraphStoreResult<Vec<u64>>
fn edge_id_page( &self, graph: &str, after: Option<u64>, limit: usize, ) -> GraphStoreResult<Vec<u64>>
Bounded ascending edge identities without materializing edge payloads.
Source§fn transaction<T>(
&mut self,
operation: impl FnOnce(&mut Self) -> GraphStoreResult<T>,
) -> GraphStoreResult<T>
fn transaction<T>( &mut self, operation: impl FnOnce(&mut Self) -> GraphStoreResult<T>, ) -> GraphStoreResult<T>
Apply a group of mutations atomically. Persistent stores use a storage
transaction or savepoint, never a cloned graph as a rollback image.
Both errors and unwinding must restore the pre-operation state.
Source§fn create_graph(&mut self, name: &str) -> GraphStoreResult<()>
fn create_graph(&mut self, name: &str) -> GraphStoreResult<()>
Create a new named graph. No-op if it already exists.
Source§fn drop_graph(&mut self, name: &str) -> GraphStoreResult<()>
fn drop_graph(&mut self, name: &str) -> GraphStoreResult<()>
Drop a named graph and all of its membership entries. Vertex /
edge records that aren’t referenced by any other graph become
unreachable and are released.
Source§fn graph_names(&self) -> GraphStoreResult<Vec<String>>
fn graph_names(&self) -> GraphStoreResult<Vec<String>>
Return all graph names sorted ascending.
fn has_graph(&self, name: &str) -> GraphStoreResult<bool>
Source§fn union_graphs(
&mut self,
g1: &str,
g2: &str,
target: &str,
) -> GraphStoreResult<()>
fn union_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> GraphStoreResult<()>
target := g1 union g2 over vertex and edge sets.Source§fn intersect_graphs(
&mut self,
g1: &str,
g2: &str,
target: &str,
) -> GraphStoreResult<()>
fn intersect_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> GraphStoreResult<()>
target := g1 intersect g2.Source§fn difference_graphs(
&mut self,
g1: &str,
g2: &str,
target: &str,
) -> GraphStoreResult<()>
fn difference_graphs( &mut self, g1: &str, g2: &str, target: &str, ) -> GraphStoreResult<()>
target := g1 \ g2.fn copy_graph(&mut self, source: &str, target: &str) -> GraphStoreResult<()>
fn add_vertex(&mut self, vertex: Vertex, graph: &str) -> GraphStoreResult<()>
fn add_edge(&mut self, edge: Edge, graph: &str) -> GraphStoreResult<()>
fn remove_vertex(&mut self, vertex_id: u64, graph: &str) -> GraphStoreResult<()>
fn remove_edge(&mut self, edge_id: u64, graph: &str) -> GraphStoreResult<()>
Source§fn neighbors(
&self,
vertex_id: u64,
label: Option<&str>,
direction: Direction,
graph: &str,
) -> GraphStoreResult<Vec<u64>>
fn neighbors( &self, vertex_id: u64, label: Option<&str>, direction: Direction, graph: &str, ) -> GraphStoreResult<Vec<u64>>
Neighbor vertex ids reached from
vertex_id along edges with the
given label (or any label when label is None) in the given
direction.fn vertices_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<Vec<Vertex>>
Source§fn vertex_ids_by_label(
&self,
label: &str,
graph: &str,
) -> GraphStoreResult<Vec<u64>>
fn vertex_ids_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<Vec<u64>>
Return only the vertex ids for a label. Stores with a label index should override this to avoid materializing full vertices.
fn vertices_in_graph(&self, graph: &str) -> GraphStoreResult<Vec<Vertex>>
fn edges_in_graph(&self, graph: &str) -> GraphStoreResult<Vec<Edge>>
fn vertex_graphs(&self, vertex_id: u64) -> GraphStoreResult<BTreeSet<String>>
fn edge_graphs(&self, edge_id: u64) -> GraphStoreResult<BTreeSet<String>>
Source§fn edges_by_label(
&self,
label: &str,
graph: &str,
) -> GraphStoreResult<Vec<Edge>>
fn edges_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<Vec<Edge>>
Read only edges carrying a label. Durable stores push this predicate
into their physical label index before fetching any payloads.
fn out_edge_ids( &self, vertex_id: u64, graph: &str, ) -> GraphStoreResult<BTreeSet<u64>>
fn in_edge_ids( &self, vertex_id: u64, graph: &str, ) -> GraphStoreResult<BTreeSet<u64>>
fn edge_ids_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<BTreeSet<u64>>
fn vertex_ids_in_graph(&self, graph: &str) -> GraphStoreResult<BTreeSet<u64>>
Source§fn require_vertex_in_graph(
&self,
vertex_id: u64,
graph: &str,
) -> GraphStoreResult<()>
fn require_vertex_in_graph( &self, vertex_id: u64, graph: &str, ) -> GraphStoreResult<()>
Require an explicit query vertex to be a live member of
graph.
Implementations may override this with a cheaper membership lookup.
Missing query input is distinct from a valid vertex with no edges and
must not be reported as an empty neighborhood/path result.fn degree_distribution( &self, graph: &str, ) -> GraphStoreResult<BTreeMap<u64, u64>>
fn label_degree(&self, label: &str, graph: &str) -> GraphStoreResult<f64>
fn vertex_label_counts( &self, graph: &str, ) -> GraphStoreResult<BTreeMap<String, u64>>
Source§fn get_vertex(&self, vertex_id: u64) -> GraphStoreResult<Option<Vertex>>
fn get_vertex(&self, vertex_id: u64) -> GraphStoreResult<Option<Vertex>>
Fetch one owned record. A storage implementation must not retain all
entities merely to return a borrow, and I/O failures are not absence.
fn get_edge(&self, edge_id: u64) -> GraphStoreResult<Option<Edge>>
Source§fn next_vertex_id(&mut self) -> GraphStoreResult<u64>
fn next_vertex_id(&mut self) -> GraphStoreResult<u64>
Returns and advances the next available vertex id.
Source§fn next_edge_id(&mut self) -> GraphStoreResult<u64>
fn next_edge_id(&mut self) -> GraphStoreResult<u64>
Returns and advances the next available edge id.
Source§fn allocate_vertex_id(
&mut self,
label: &str,
graph: &str,
) -> GraphStoreResult<u64>
fn allocate_vertex_id( &mut self, label: &str, graph: &str, ) -> GraphStoreResult<u64>
Allocate a vertex id for a new entity with
label inside
graph. Stores that implement the Apache AGE graphid scheme
override this to return (label_id << 48) | sequence; the
default falls back to the store-wide counter.Source§fn allocate_edge_id(
&mut self,
label: &str,
graph: &str,
) -> GraphStoreResult<u64>
fn allocate_edge_id( &mut self, label: &str, graph: &str, ) -> GraphStoreResult<u64>
fn clear(&mut self) -> GraphStoreResult<()>
Auto Trait Implementations§
impl !Freeze for SQLiteGraphStore
impl !RefUnwindSafe for SQLiteGraphStore
impl !UnwindSafe for SQLiteGraphStore
impl Send for SQLiteGraphStore
impl Sync for SQLiteGraphStore
impl Unpin for SQLiteGraphStore
impl UnsafeUnpin for SQLiteGraphStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more