pub struct KuzuGraphStore { /* private fields */ }Expand description
Local KuzuDB-backed implementation of GraphStore.
One database file per repo (graph.kuzu), with per-branch node/edge tables
inside it. A fresh Connection is created for each operation so we avoid
the self-referential lifetime that Mutex<Connection<'db>> would require.
Implementations§
Source§impl KuzuGraphStore
impl KuzuGraphStore
Sourcepub fn open(repo_root: &Path) -> Result<Self>
pub fn open(repo_root: &Path) -> Result<Self>
Open (or create) the graph database for the repo at repo_root.
If the persisted schema version doesn’t match SCHEMA_VERSION, the
entire repo data directory is wiped so a fresh full index runs on next
hook invocation.
Trait Implementations§
Source§impl GraphStore for KuzuGraphStore
impl GraphStore for KuzuGraphStore
Source§fn apply_diff(&mut self, branch: &str, diff: &GraphDiff) -> Result<()>
fn apply_diff(&mut self, branch: &str, diff: &GraphDiff) -> Result<()>
Apply an incremental diff to the named branch’s graph.
Source§fn lookup_symbol(
&self,
branch: &str,
name: &str,
fuzzy: bool,
) -> Result<Vec<Node>>
fn lookup_symbol( &self, branch: &str, name: &str, fuzzy: bool, ) -> Result<Vec<Node>>
Find all nodes matching
name on branch.
When fuzzy is true, matches any node whose name contains name
(case-sensitive substring). When false, exact match only.Source§fn find_callers(&self, branch: &str, function_name: &str) -> Result<Vec<Node>>
fn find_callers(&self, branch: &str, function_name: &str) -> Result<Vec<Node>>
Find all call-site nodes whose outgoing
Calls edge points to a node
named function_name on branch (single hop).Source§fn find_callers_deep(
&self,
branch: &str,
function_name: &str,
depth: u8,
) -> Result<CallersDeep>
fn find_callers_deep( &self, branch: &str, function_name: &str, depth: u8, ) -> Result<CallersDeep>
Multi-hop BFS: find callers up to
depth hops away.
Returns callers grouped by hop distance (1..=depth).
depth is capped at 5 to prevent runaway queries.Source§fn symbol_context(&self, branch: &str, name: &str) -> Result<SymbolContext>
fn symbol_context(&self, branch: &str, name: &str) -> Result<SymbolContext>
Return a 360° view of a symbol: its definition, direct callers,
direct callees, and nodes that reference it via
Uses edges.Source§fn list_definitions(&self, branch: &str, file: &Path) -> Result<Vec<Node>>
fn list_definitions(&self, branch: &str, file: &Path) -> Result<Vec<Node>>
List all top-level definitions in
file on branch.Source§fn branch_diff(&self, from: &str, to: &str) -> Result<GraphDiff>
fn branch_diff(&self, from: &str, to: &str) -> Result<GraphDiff>
Return the graph delta between two branches as a
GraphDiff.
Nodes/edges present in to but not from are in added_*.
Nodes/edges present in from but not to are in removed_*.Source§fn list_all_nodes(&self, branch: &str) -> Result<Vec<Node>>
fn list_all_nodes(&self, branch: &str) -> Result<Vec<Node>>
Return all nodes in
branch’s graph.Source§fn list_all_edges(&self, branch: &str) -> Result<Vec<Edge>>
fn list_all_edges(&self, branch: &str) -> Result<Vec<Edge>>
Return all edges in
branch’s graph.Source§fn find_callees(
&self,
branch: &str,
function_name: &str,
depth: u8,
) -> Result<CallersDeep>
fn find_callees( &self, branch: &str, function_name: &str, depth: u8, ) -> Result<CallersDeep>
Find all functions/methods called by
function_name up to depth hops.
Returns callees grouped by hop distance (1..=depth). Capped at 5.Source§fn find_implementors(
&self,
branch: &str,
trait_or_interface_name: &str,
) -> Result<Vec<Node>>
fn find_implementors( &self, branch: &str, trait_or_interface_name: &str, ) -> Result<Vec<Node>>
Find all structs/classes that implement/inherit
trait_or_interface_name.Source§fn trace_path(&self, branch: &str, from: &str, to: &str) -> Result<Vec<Node>>
fn trace_path(&self, branch: &str, from: &str, to: &str) -> Result<Vec<Node>>
Find all call paths between
from and to using BFS.
Returns at most one path (the shortest), as a sequence of nodes.Source§fn list_symbols_in_range(
&self,
branch: &str,
file: &Path,
start_line: u32,
end_line: u32,
) -> Result<Vec<Node>>
fn list_symbols_in_range( &self, branch: &str, file: &Path, start_line: u32, end_line: u32, ) -> Result<Vec<Node>>
Find all nodes in
file whose span overlaps [start_line, end_line].Source§fn find_unused_symbols(
&self,
branch: &str,
kind: Option<NodeKind>,
) -> Result<Vec<Node>>
fn find_unused_symbols( &self, branch: &str, kind: Option<NodeKind>, ) -> Result<Vec<Node>>
Find symbols with no incoming Calls or Uses edges (potential dead code).
If
kind is provided, filters to only that NodeKind.Source§fn get_subgraph(
&self,
branch: &str,
seed_name: &str,
depth: u8,
direction: &str,
) -> Result<SubGraph>
fn get_subgraph( &self, branch: &str, seed_name: &str, depth: u8, direction: &str, ) -> Result<SubGraph>
Return a subgraph centred on
seed_name up to depth hops.
direction: “in” (callers), “out” (callees), or “both”.Auto Trait Implementations§
impl !Freeze for KuzuGraphStore
impl !RefUnwindSafe for KuzuGraphStore
impl Send for KuzuGraphStore
impl Sync for KuzuGraphStore
impl Unpin for KuzuGraphStore
impl UnsafeUnpin for KuzuGraphStore
impl UnwindSafe for KuzuGraphStore
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