pub struct SqliteGraphBackend { /* private fields */ }Expand description
SQLite-backed implementation of the GraphBackend trait.
This struct wraps a SqliteGraph instance and implements all GraphBackend methods by delegating to the underlying SQLite-based graph operations.
Implementations§
Source§impl SqliteGraphBackend
impl SqliteGraphBackend
Sourcepub fn in_memory() -> Result<Self, SqliteGraphError>
pub fn in_memory() -> Result<Self, SqliteGraphError>
Create a new SQLite backend with an in-memory database.
Sourcepub fn from_graph(graph: SqliteGraph) -> Self
pub fn from_graph(graph: SqliteGraph) -> Self
Create a new SQLite backend from an existing SqliteGraph instance.
Sourcepub fn graph(&self) -> &SqliteGraph
pub fn graph(&self) -> &SqliteGraph
Get a reference to the underlying SqliteGraph instance.
Sourcepub fn entity_ids(&self) -> Result<Vec<i64>, SqliteGraphError>
pub fn entity_ids(&self) -> Result<Vec<i64>, SqliteGraphError>
Get all entity IDs from the graph.
Trait Implementations§
Source§impl GraphBackend for SqliteGraphBackend
impl GraphBackend for SqliteGraphBackend
fn insert_node(&self, node: NodeSpec) -> Result<i64, SqliteGraphError>
fn get_node( &self, snapshot_id: SnapshotId, id: i64, ) -> Result<GraphEntity, SqliteGraphError>
fn insert_edge(&self, edge: EdgeSpec) -> Result<i64, SqliteGraphError>
Source§fn delete_entity(&self, id: i64) -> Result<(), SqliteGraphError>
fn delete_entity(&self, id: i64) -> Result<(), SqliteGraphError>
Delete an entity (node) from the graph by ID Read more
Source§fn entity_ids(&self) -> Result<Vec<i64>, SqliteGraphError>
fn entity_ids(&self) -> Result<Vec<i64>, SqliteGraphError>
Get all entity IDs from the graph Read more
fn neighbors( &self, snapshot_id: SnapshotId, node: i64, query: NeighborQuery, ) -> Result<Vec<i64>, SqliteGraphError>
fn bfs( &self, snapshot_id: SnapshotId, start: i64, depth: u32, ) -> Result<Vec<i64>, SqliteGraphError>
fn shortest_path( &self, snapshot_id: SnapshotId, start: i64, end: i64, ) -> Result<Option<Vec<i64>>, SqliteGraphError>
fn node_degree( &self, snapshot_id: SnapshotId, node: i64, ) -> Result<(usize, usize), SqliteGraphError>
fn k_hop( &self, snapshot_id: SnapshotId, start: i64, depth: u32, direction: BackendDirection, ) -> Result<Vec<i64>, SqliteGraphError>
fn k_hop_filtered( &self, snapshot_id: SnapshotId, start: i64, depth: u32, direction: BackendDirection, allowed_edge_types: &[&str], ) -> Result<Vec<i64>, SqliteGraphError>
fn chain_query( &self, snapshot_id: SnapshotId, start: i64, chain: &[ChainStep], ) -> Result<Vec<i64>, SqliteGraphError>
fn pattern_search( &self, snapshot_id: SnapshotId, start: i64, pattern: &PatternQuery, ) -> Result<Vec<PatternMatch>, SqliteGraphError>
Source§fn checkpoint(&self) -> Result<(), SqliteGraphError>
fn checkpoint(&self) -> Result<(), SqliteGraphError>
Trigger WAL checkpoint for backends that support write-ahead logging Read more
Source§fn backup(&self, backup_dir: &Path) -> Result<BackupResult, SqliteGraphError>
fn backup(&self, backup_dir: &Path) -> Result<BackupResult, SqliteGraphError>
Create a backup of the database Read more
Source§fn snapshot_export(
&self,
export_dir: &Path,
) -> Result<SnapshotMetadata, SqliteGraphError>
fn snapshot_export( &self, export_dir: &Path, ) -> Result<SnapshotMetadata, SqliteGraphError>
Export database snapshot to the specified directory Read more
Source§fn snapshot_import(
&self,
import_dir: &Path,
) -> Result<ImportMetadata, SqliteGraphError>
fn snapshot_import( &self, import_dir: &Path, ) -> Result<ImportMetadata, SqliteGraphError>
Import database snapshot from the specified directory Read more
Source§fn query_nodes_by_kind(
&self,
_snapshot_id: SnapshotId,
kind: &str,
) -> Result<Vec<i64>, SqliteGraphError>
fn query_nodes_by_kind( &self, _snapshot_id: SnapshotId, kind: &str, ) -> Result<Vec<i64>, SqliteGraphError>
Query all nodes with a given kind Read more
Source§fn query_nodes_by_name_pattern(
&self,
_snapshot_id: SnapshotId,
pattern: &str,
) -> Result<Vec<i64>, SqliteGraphError>
fn query_nodes_by_name_pattern( &self, _snapshot_id: SnapshotId, pattern: &str, ) -> Result<Vec<i64>, SqliteGraphError>
Query nodes by name pattern using glob matching Read more
Auto Trait Implementations§
impl !Freeze for SqliteGraphBackend
impl !RefUnwindSafe for SqliteGraphBackend
impl !Send for SqliteGraphBackend
impl !Sync for SqliteGraphBackend
impl Unpin for SqliteGraphBackend
impl !UnwindSafe for SqliteGraphBackend
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more