project_rag/relations/storage/
mod.rs1mod lance_store;
7
8pub use lance_store::LanceRelationsStore;
9
10use anyhow::Result;
11use async_trait::async_trait;
12
13use crate::relations::types::{CallEdge, Definition, Reference};
14
15#[async_trait]
17pub trait RelationsStore: Send + Sync {
18 async fn store_definitions(
20 &self,
21 definitions: Vec<Definition>,
22 root_path: &str,
23 ) -> Result<usize>;
24
25 async fn store_references(&self, references: Vec<Reference>, root_path: &str) -> Result<usize>;
27
28 async fn find_definition_at(
30 &self,
31 file_path: &str,
32 line: usize,
33 column: usize,
34 ) -> Result<Option<Definition>>;
35
36 async fn find_definitions_by_name(&self, name: &str) -> Result<Vec<Definition>>;
38
39 async fn find_references(&self, target_symbol_id: &str) -> Result<Vec<Reference>>;
41
42 async fn get_callers(&self, symbol_id: &str) -> Result<Vec<CallEdge>>;
44
45 async fn get_callees(&self, symbol_id: &str) -> Result<Vec<CallEdge>>;
47
48 async fn delete_by_file(&self, file_path: &str) -> Result<usize>;
50
51 async fn clear(&self) -> Result<()>;
53
54 async fn get_stats(&self) -> Result<RelationsStats>;
56}
57
58#[derive(Debug, Clone, Default)]
60pub struct RelationsStats {
61 pub definition_count: usize,
63 pub reference_count: usize,
65 pub files_with_definitions: usize,
67}