GraphStore

Struct GraphStore 

Source
pub struct GraphStore { /* private fields */ }
Expand description

The main graph store

Implementations§

Source§

impl GraphStore

Source

pub fn open(path: impl AsRef<Path>) -> CadiResult<Self>

Open or create a graph store at the given path

Source

pub fn in_memory() -> CadiResult<Self>

Create an in-memory graph store (for testing)

Source

pub fn insert_node(&self, node: &GraphNode) -> CadiResult<()>

Insert or update a graph node

Source

pub fn get_node(&self, chunk_id: &str) -> CadiResult<Option<GraphNode>>

Get a node by chunk ID

Source

pub fn node_exists(&self, chunk_id: &str) -> CadiResult<bool>

Check if a node exists

Source

pub fn delete_node(&self, chunk_id: &str) -> CadiResult<bool>

Delete a node and its edges

Source

pub fn store_content(&self, chunk_id: &str, content: &[u8]) -> CadiResult<()>

Store chunk content

Source

pub fn get_content(&self, chunk_id: &str) -> CadiResult<Option<Vec<u8>>>

Get chunk content

Source

pub fn get_content_str(&self, chunk_id: &str) -> CadiResult<Option<String>>

Get content as string

Source

pub fn add_dependency( &self, source: &str, target: &str, edge_type: EdgeType, ) -> CadiResult<()>

Add a dependency edge: source depends on target

Source

pub fn get_dependencies( &self, chunk_id: &str, ) -> CadiResult<Vec<(EdgeType, String)>>

Get all dependencies of a chunk (things it needs)

Source

pub fn get_dependents( &self, chunk_id: &str, ) -> CadiResult<Vec<(EdgeType, String)>>

Get all dependents of a chunk (things that need it)

Source

pub fn get_dependencies_of_type( &self, chunk_id: &str, edge_type: EdgeType, ) -> CadiResult<Vec<String>>

Get dependencies filtered by edge type

Source

pub fn find_symbol(&self, symbol: &str) -> CadiResult<Option<String>>

Find the chunk that defines a symbol

Source

pub fn resolve_alias(&self, alias: &str) -> CadiResult<Option<String>>

Resolve an alias to chunk ID

Source

pub fn get_symbols_for_chunk(&self, chunk_id: &str) -> CadiResult<Vec<String>>

Get all symbols defined by a chunk

Source

pub fn query(&self, query: &GraphQuery) -> CadiResult<QueryResult>

Execute a graph query

Source

pub fn get_token_estimate(&self, chunk_id: &str) -> CadiResult<usize>

Get token estimate for a chunk

Source

pub fn stats(&self) -> CadiResult<GraphStoreStats>

Get store statistics

Source

pub fn flush(&self) -> CadiResult<()>

Flush all pending writes to disk

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more