pub struct GraphStore { /* private fields */ }Expand description
The main graph store
Implementations§
Source§impl GraphStore
impl GraphStore
Sourcepub fn open(path: impl AsRef<Path>) -> CadiResult<Self>
pub fn open(path: impl AsRef<Path>) -> CadiResult<Self>
Open or create a graph store at the given path
Sourcepub fn in_memory() -> CadiResult<Self>
pub fn in_memory() -> CadiResult<Self>
Create an in-memory graph store (for testing)
Sourcepub fn insert_node(&self, node: &GraphNode) -> CadiResult<()>
pub fn insert_node(&self, node: &GraphNode) -> CadiResult<()>
Insert or update a graph node
Sourcepub fn node_exists(&self, chunk_id: &str) -> CadiResult<bool>
pub fn node_exists(&self, chunk_id: &str) -> CadiResult<bool>
Check if a node exists
Sourcepub fn delete_node(&self, chunk_id: &str) -> CadiResult<bool>
pub fn delete_node(&self, chunk_id: &str) -> CadiResult<bool>
Delete a node and its edges
Sourcepub fn store_content(&self, chunk_id: &str, content: &[u8]) -> CadiResult<()>
pub fn store_content(&self, chunk_id: &str, content: &[u8]) -> CadiResult<()>
Store chunk content
Sourcepub fn get_content(&self, chunk_id: &str) -> CadiResult<Option<Vec<u8>>>
pub fn get_content(&self, chunk_id: &str) -> CadiResult<Option<Vec<u8>>>
Get chunk content
Sourcepub fn get_content_str(&self, chunk_id: &str) -> CadiResult<Option<String>>
pub fn get_content_str(&self, chunk_id: &str) -> CadiResult<Option<String>>
Get content as string
Sourcepub fn add_dependency(
&self,
source: &str,
target: &str,
edge_type: EdgeType,
) -> CadiResult<()>
pub fn add_dependency( &self, source: &str, target: &str, edge_type: EdgeType, ) -> CadiResult<()>
Add a dependency edge: source depends on target
Sourcepub fn get_dependencies(
&self,
chunk_id: &str,
) -> CadiResult<Vec<(EdgeType, String)>>
pub fn get_dependencies( &self, chunk_id: &str, ) -> CadiResult<Vec<(EdgeType, String)>>
Get all dependencies of a chunk (things it needs)
Sourcepub fn get_dependents(
&self,
chunk_id: &str,
) -> CadiResult<Vec<(EdgeType, String)>>
pub fn get_dependents( &self, chunk_id: &str, ) -> CadiResult<Vec<(EdgeType, String)>>
Get all dependents of a chunk (things that need it)
Sourcepub fn get_dependencies_of_type(
&self,
chunk_id: &str,
edge_type: EdgeType,
) -> CadiResult<Vec<String>>
pub fn get_dependencies_of_type( &self, chunk_id: &str, edge_type: EdgeType, ) -> CadiResult<Vec<String>>
Get dependencies filtered by edge type
Sourcepub fn find_symbol(&self, symbol: &str) -> CadiResult<Option<String>>
pub fn find_symbol(&self, symbol: &str) -> CadiResult<Option<String>>
Find the chunk that defines a symbol
Sourcepub fn resolve_alias(&self, alias: &str) -> CadiResult<Option<String>>
pub fn resolve_alias(&self, alias: &str) -> CadiResult<Option<String>>
Resolve an alias to chunk ID
Sourcepub fn get_symbols_for_chunk(&self, chunk_id: &str) -> CadiResult<Vec<String>>
pub fn get_symbols_for_chunk(&self, chunk_id: &str) -> CadiResult<Vec<String>>
Get all symbols defined by a chunk
Sourcepub fn query(&self, query: &GraphQuery) -> CadiResult<QueryResult>
pub fn query(&self, query: &GraphQuery) -> CadiResult<QueryResult>
Execute a graph query
Sourcepub fn get_token_estimate(&self, chunk_id: &str) -> CadiResult<usize>
pub fn get_token_estimate(&self, chunk_id: &str) -> CadiResult<usize>
Get token estimate for a chunk
Sourcepub fn stats(&self) -> CadiResult<GraphStoreStats>
pub fn stats(&self) -> CadiResult<GraphStoreStats>
Get store statistics
Sourcepub fn flush(&self) -> CadiResult<()>
pub fn flush(&self) -> CadiResult<()>
Flush all pending writes to disk
Auto Trait Implementations§
impl Freeze for GraphStore
impl !RefUnwindSafe for GraphStore
impl Send for GraphStore
impl Sync for GraphStore
impl Unpin for GraphStore
impl !UnwindSafe for GraphStore
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