pub struct SqliteGraph { /* private fields */ }Expand description
Embedded SQLite-backed graph database.
Provides a lightweight, deterministic graph database with entity and edge storage, pattern matching, MVCC-lite snapshots, and deterministic indexing.
Implementations§
Source§impl SqliteGraph
impl SqliteGraph
pub fn outgoing_cache_ref(&self) -> &AdjacencyCache
pub fn incoming_cache_ref(&self) -> &AdjacencyCache
Source§impl SqliteGraph
impl SqliteGraph
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, SqliteGraphError>
pub fn open_without_migrations<P: AsRef<Path>>( path: P, ) -> Result<Self, SqliteGraphError>
pub fn open_in_memory() -> Result<Self, SqliteGraphError>
pub fn open_in_memory_without_migrations() -> Result<Self, SqliteGraphError>
Source§impl SqliteGraph
impl SqliteGraph
pub fn insert_edge(&self, edge: &GraphEdge) -> Result<i64, SqliteGraphError>
pub fn get_edge(&self, id: i64) -> Result<GraphEdge, SqliteGraphError>
pub fn delete_edge(&self, id: i64) -> Result<(), SqliteGraphError>
Source§impl SqliteGraph
impl SqliteGraph
pub fn insert_entity( &self, entity: &GraphEntity, ) -> Result<i64, SqliteGraphError>
pub fn get_entity(&self, id: i64) -> Result<GraphEntity, SqliteGraphError>
pub fn update_entity( &self, entity: &GraphEntity, ) -> Result<(), SqliteGraphError>
pub fn delete_entity(&self, id: i64) -> Result<(), SqliteGraphError>
pub fn list_entity_ids(&self) -> Result<Vec<i64>, SqliteGraphError>
Source§impl SqliteGraph
impl SqliteGraph
pub fn metrics_snapshot(&self) -> GraphMetricsSnapshot
pub fn reset_metrics(&self)
pub fn schema_version(&self) -> Result<i64, SqliteGraphError>
pub fn run_pending_migrations( &self, dry_run: bool, ) -> Result<MigrationReport, SqliteGraphError>
Source§impl SqliteGraph
impl SqliteGraph
Sourcepub fn match_triples(
&self,
pattern: &PatternTriple,
) -> Result<Vec<TripleMatch>, SqliteGraphError>
pub fn match_triples( &self, pattern: &PatternTriple, ) -> Result<Vec<TripleMatch>, SqliteGraphError>
Match lightweight triple patterns using pattern engine.
This method provides a simple interface for matching single-hop patterns like (start_label)-[edge_type]->(end_label) with optional property filters.
§Arguments
pattern- The pattern triple to match
§Returns
A vector of triple matches in deterministic order
Sourcepub fn match_triples_fast(
&self,
pattern: &PatternTriple,
) -> Result<Vec<TripleMatch>, SqliteGraphError>
pub fn match_triples_fast( &self, pattern: &PatternTriple, ) -> Result<Vec<TripleMatch>, SqliteGraphError>
Match lightweight triple patterns using cache-enabled fast-path.
This method provides an optimized version of pattern matching that:
- Uses cache as a fast-path where safe
- Falls back to SQL where pattern requires it
- Returns IDENTICAL results to match_triples()
- Maintains deterministic ordering
§Arguments
pattern- The pattern triple to match
§Returns
A vector of triple matches in deterministic order
Source§impl SqliteGraph
impl SqliteGraph
Sourcepub fn acquire_snapshot(&self) -> Result<GraphSnapshot, SqliteGraphError>
pub fn acquire_snapshot(&self) -> Result<GraphSnapshot, SqliteGraphError>
Acquire a deterministic snapshot of the current graph state
Returns a read-only snapshot that provides isolated access to graph data. The snapshot contains cloned adjacency maps and uses a read-only SQLite connection.
§Returns
Result containing GraphSnapshot or error
Sourcepub fn snapshot_node_count(&self) -> usize
pub fn snapshot_node_count(&self) -> usize
Get the number of nodes in the current snapshot
Sourcepub fn snapshot_edge_count(&self) -> usize
pub fn snapshot_edge_count(&self) -> usize
Get the number of edges in the current snapshot
Sourcepub fn snapshot_contains_node(&self, node_id: i64) -> bool
pub fn snapshot_contains_node(&self, node_id: i64) -> bool
Check if a node exists in the current snapshot