Skip to main content

InMemoryGraphStore

Struct InMemoryGraphStore 

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

In-memory implementation of GraphStore. Nodes are keyed by id (globally unique); user/scope indexed for get_all_memory_items and search filtering.

Implementations§

Trait Implementations§

Source§

impl Default for InMemoryGraphStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GraphStore for InMemoryGraphStore

Source§

fn add_node<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, id: &'life1 str, memory: &'life2 str, metadata: &'life3 HashMap<String, Value>, user_name: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Add a single memory node.
Source§

fn add_nodes_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, nodes: &'life1 [MemoryNode], user_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add multiple nodes in batch.
Source§

fn add_edges_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, edges: &'life1 [MemoryEdge], user_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add multiple edges in batch.
Source§

fn get_node<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, include_embedding: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<MemoryNode>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get one node by id.
Source§

fn get_nodes<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], include_embedding: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryNode>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get multiple nodes by ids.
Source§

fn get_neighbors<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 str, relation: Option<&'life2 str>, direction: GraphDirection, limit: usize, include_embedding: bool, user_name: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphNeighbor>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Get neighbors of one node, optionally filtered by relation and direction.
Source§

fn shortest_path<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, source_id: &'life1 str, target_id: &'life2 str, relation: Option<&'life3 str>, direction: GraphDirection, max_depth: usize, include_deleted: bool, user_name: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<GraphPath>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Shortest path query between source and target by BFS hops.
Source§

fn find_paths<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, source_id: &'life1 str, target_id: &'life2 str, relation: Option<&'life3 str>, direction: GraphDirection, max_depth: usize, top_k: usize, include_deleted: bool, user_name: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphPath>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Enumerate top-k shortest simple paths by BFS hops.
Source§

fn search_by_embedding<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, vector: &'life1 [f32], top_k: usize, user_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<VecSearchHit>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Search by embedding vector (returns node ids + scores).
Source§

fn get_all_memory_items<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 str, user_name: &'life2 str, include_embedding: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryNode>, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get all memory items for a scope and user.
Source§

fn update_node<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id: &'life1 str, fields: &'life2 HashMap<String, Value>, user_name: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Update fields of an existing node (memory and/or metadata).
Source§

fn delete_node<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, user_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a node (hard delete). If user_name is Some, implementation must verify the node belongs to that user/cube (e.g. via metadata) before deleting; return error if not owner.
Source§

fn delete_edges_by_node<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, user_name: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<usize, GraphStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete all edges connected to a node. Returns number of deleted edges.

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, 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, 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.