pub struct MemoryGraphStore { /* private fields */ }Implementations§
Source§impl MemoryGraphStore
impl MemoryGraphStore
pub fn new() -> Self
Sourcepub fn insert_raw_vertex(&mut self, vertex: Vertex) -> GraphStoreResult<()>
pub fn insert_raw_vertex(&mut self, vertex: Vertex) -> GraphStoreResult<()>
Insert a vertex into the global registry without attaching it
to any graph. Used by the SQLite-backed store on hydration
before membership is restored from the persisted catalog.
Sourcepub fn insert_raw_edge(&mut self, edge: Edge) -> GraphStoreResult<()>
pub fn insert_raw_edge(&mut self, edge: Edge) -> GraphStoreResult<()>
Insert an edge before graph memberships are restored. Endpoint
validation is deferred until attach_edge, when the graph’s persisted
label tombstones are available.
Sourcepub fn attach_vertex(
&mut self,
vertex_id: VertexId,
graph: &str,
) -> GraphStoreResult<()>
pub fn attach_vertex( &mut self, vertex_id: VertexId, graph: &str, ) -> GraphStoreResult<()>
Attach a previously inserted vertex to the named graph. The
graph must already exist (create_graph).
pub fn attach_edge( &mut self, edge_id: EdgeId, graph: &str, ) -> GraphStoreResult<()>
Sourcepub fn out_edge_ids_for_graph(
&self,
graph: &str,
) -> GraphStoreResult<BTreeSet<EdgeId>>
pub fn out_edge_ids_for_graph( &self, graph: &str, ) -> GraphStoreResult<BTreeSet<EdgeId>>
All edge ids that participate in graph, in stable id order.
Helper for the SQLite-backed store’s bulk write paths.
Sourcepub fn label_registry(&self, graph: &str) -> GraphLabelRegistry
pub fn label_registry(&self, graph: &str) -> GraphLabelRegistry
Snapshot of the AGE label registry for graph (empty registry
when the graph has never allocated an id).
Sourcepub fn import_label_registry(
&mut self,
graph: &str,
registry: &GraphLabelRegistry,
)
pub fn import_label_registry( &mut self, graph: &str, registry: &GraphLabelRegistry, )
Install (merge) a persisted label registry for graph. Existing
in-memory state wins on conflicts except that the larger
sequence / label-id watermarks are kept.
Sourcepub fn rebuild_label_registry_from_ids(&mut self, graph: &str)
pub fn rebuild_label_registry_from_ids(&mut self, graph: &str)
Re-derive the label registry of graph from the ids of the
entities currently attached to it. Self-heals restored graphs
whose registry metadata is missing: label_id = id >> 48.
Sourcepub fn graph_labels(&self, graph: &str) -> GraphStoreResult<Vec<GraphLabelInfo>>
pub fn graph_labels(&self, graph: &str) -> GraphStoreResult<Vec<GraphLabelInfo>>
Every present ag_label entry of graph, in label-id order.
Sourcepub fn graph_label_kind(
&self,
graph: &str,
label: &str,
) -> GraphStoreResult<Option<LabelKind>>
pub fn graph_label_kind( &self, graph: &str, label: &str, ) -> GraphStoreResult<Option<LabelKind>>
The kind of label in graph, or None when the label is not
registered there.
Sourcepub fn create_label(
&mut self,
graph: &str,
label: &str,
kind: LabelKind,
) -> GraphStoreResult<Option<u32>>
pub fn create_label( &mut self, graph: &str, label: &str, kind: LabelKind, ) -> GraphStoreResult<Option<u32>>
Register an empty user label in graph (create_vlabel /
create_elabel). Returns the label id, or None when a label of
that name already exists in the graph. A missing default relation of
the requested kind prevents new child labels, as it does in AGE.
Sourcepub fn drop_label(
&mut self,
graph: &str,
label: &str,
) -> GraphStoreResult<Option<(u32, LabelKind)>>
pub fn drop_label( &mut self, graph: &str, label: &str, ) -> GraphStoreResult<Option<(u32, LabelKind)>>
Drop a label from graph together with every entity that carries it
(drop_label, which AGE implements as DROP TABLE on the label
relation). Vertex rows are removed while incident rows in edge-label
relations survive with dangling endpoint ids. A default label can be
dropped only when no user label of that kind inherits from it. Returns
the released label id and kind, or None when the label is not
registered.
Sourcepub fn rename_graph(&mut self, from: &str, to: &str) -> GraphStoreResult<()>
pub fn rename_graph(&mut self, from: &str, to: &str) -> GraphStoreResult<()>
Rename graph from to to, carrying its partition, memberships,
and label registry over. Fails when from is missing or to
already exists.
Trait Implementations§
Source§impl Clone for MemoryGraphStore
impl Clone for MemoryGraphStore
Source§fn clone(&self) -> MemoryGraphStore
fn clone(&self) -> MemoryGraphStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryGraphStore
impl Debug for MemoryGraphStore
Source§impl Default for MemoryGraphStore
impl Default for MemoryGraphStore
Source§fn default() -> MemoryGraphStore
fn default() -> MemoryGraphStore
Source§impl GraphStore for MemoryGraphStore
impl GraphStore for MemoryGraphStore
Source§fn create_graph(&mut self, name: &str)
fn create_graph(&mut self, name: &str)
Source§fn drop_graph(&mut self, name: &str)
fn drop_graph(&mut self, name: &str)
Source§fn graph_names(&self) -> Vec<String>
fn graph_names(&self) -> Vec<String>
fn has_graph(&self, name: &str) -> 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: VertexId, graph: &str, ) -> GraphStoreResult<()>
fn remove_edge(&mut self, edge_id: EdgeId, graph: &str) -> GraphStoreResult<()>
Source§fn neighbors(
&self,
vertex_id: VertexId,
label: Option<&str>,
direction: Direction,
graph: &str,
) -> GraphStoreResult<Vec<VertexId>>
fn neighbors( &self, vertex_id: VertexId, label: Option<&str>, direction: Direction, graph: &str, ) -> GraphStoreResult<Vec<VertexId>>
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<VertexId>>
fn vertex_ids_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<Vec<VertexId>>
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: VertexId) -> BTreeSet<String>
fn out_edge_ids( &self, vertex_id: VertexId, graph: &str, ) -> GraphStoreResult<BTreeSet<EdgeId>>
fn in_edge_ids( &self, vertex_id: VertexId, graph: &str, ) -> GraphStoreResult<BTreeSet<EdgeId>>
fn edge_ids_by_label( &self, label: &str, graph: &str, ) -> GraphStoreResult<BTreeSet<EdgeId>>
fn vertex_ids_in_graph( &self, graph: &str, ) -> GraphStoreResult<BTreeSet<VertexId>>
Source§fn require_vertex_in_graph(
&self,
vertex_id: VertexId,
graph: &str,
) -> GraphStoreResult<()>
fn require_vertex_in_graph( &self, vertex_id: VertexId, graph: &str, ) -> GraphStoreResult<()>
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<VertexId, u64>>
fn label_degree(&self, label: &str, graph: &str) -> GraphStoreResult<f64>
fn vertex_label_counts( &self, graph: &str, ) -> GraphStoreResult<BTreeMap<String, u64>>
fn get_vertex(&self, vertex_id: VertexId) -> Option<&Vertex>
fn get_edge(&self, edge_id: EdgeId) -> Option<&Edge>
Source§fn next_vertex_id(&mut self) -> GraphStoreResult<VertexId>
fn next_vertex_id(&mut self) -> GraphStoreResult<VertexId>
Source§fn next_edge_id(&mut self) -> GraphStoreResult<EdgeId>
fn next_edge_id(&mut self) -> GraphStoreResult<EdgeId>
Source§fn allocate_vertex_id(
&mut self,
label: &str,
graph: &str,
) -> GraphStoreResult<VertexId>
fn allocate_vertex_id( &mut self, label: &str, graph: &str, ) -> GraphStoreResult<VertexId>
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.