pub trait GraphBackend {
// Required methods
fn insert_node(&self, node: NodeSpec) -> Result<i64, SqliteGraphError>;
fn get_node(&self, id: i64) -> Result<GraphEntity, SqliteGraphError>;
fn insert_edge(&self, edge: EdgeSpec) -> Result<i64, SqliteGraphError>;
fn neighbors(
&self,
node: i64,
query: NeighborQuery,
) -> Result<Vec<i64>, SqliteGraphError>;
fn bfs(&self, start: i64, depth: u32) -> Result<Vec<i64>, SqliteGraphError>;
fn shortest_path(
&self,
start: i64,
end: i64,
) -> Result<Option<Vec<i64>>, SqliteGraphError>;
fn node_degree(&self, node: i64) -> Result<(usize, usize), SqliteGraphError>;
fn k_hop(
&self,
start: i64,
depth: u32,
direction: BackendDirection,
) -> Result<Vec<i64>, SqliteGraphError>;
fn k_hop_filtered(
&self,
start: i64,
depth: u32,
direction: BackendDirection,
allowed_edge_types: &[&str],
) -> Result<Vec<i64>, SqliteGraphError>;
fn chain_query(
&self,
start: i64,
chain: &[ChainStep],
) -> Result<Vec<i64>, SqliteGraphError>;
fn pattern_search(
&self,
start: i64,
pattern: &PatternQuery,
) -> Result<Vec<PatternMatch>, SqliteGraphError>;
}Expand description
Backend trait defining the interface for graph database backends.
Each trait method delegates to backend-specific primitives while ensuring deterministic behavior and a single integration surface for consumers.
Required Methods§
fn insert_node(&self, node: NodeSpec) -> Result<i64, SqliteGraphError>
fn get_node(&self, id: i64) -> Result<GraphEntity, SqliteGraphError>
fn insert_edge(&self, edge: EdgeSpec) -> Result<i64, SqliteGraphError>
fn neighbors( &self, node: i64, query: NeighborQuery, ) -> Result<Vec<i64>, SqliteGraphError>
fn bfs(&self, start: i64, depth: u32) -> Result<Vec<i64>, SqliteGraphError>
fn shortest_path( &self, start: i64, end: i64, ) -> Result<Option<Vec<i64>>, SqliteGraphError>
fn node_degree(&self, node: i64) -> Result<(usize, usize), SqliteGraphError>
fn k_hop( &self, start: i64, depth: u32, direction: BackendDirection, ) -> Result<Vec<i64>, SqliteGraphError>
fn k_hop_filtered( &self, start: i64, depth: u32, direction: BackendDirection, allowed_edge_types: &[&str], ) -> Result<Vec<i64>, SqliteGraphError>
fn chain_query( &self, start: i64, chain: &[ChainStep], ) -> Result<Vec<i64>, SqliteGraphError>
fn pattern_search( &self, start: i64, pattern: &PatternQuery, ) -> Result<Vec<PatternMatch>, SqliteGraphError>
Implementations on Foreign Types§
Source§impl<B> GraphBackend for &Bwhere
B: GraphBackend + ?Sized,
Reference implementation for GraphBackend trait that works with references.
impl<B> GraphBackend for &Bwhere
B: GraphBackend + ?Sized,
Reference implementation for GraphBackend trait that works with references.