Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore: Send + Sync {
    // Required methods
    fn add_entities<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        entities: &'life1 [Entity],
        filter: &'life2 MemoryFilter,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn add_relations<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        relations: &'life1 [Relation],
        entities: &'life2 [Entity],
        filter: &'life3 MemoryFilter,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        filter: &'life2 MemoryFilter,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphSearchResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn search_by_embedding<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        embedding: &'life1 [f32],
        filter: &'life2 MemoryFilter,
        threshold: f32,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphSearchResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn invalidate_relations<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        triples: &'life1 [(String, String, String)],
        filter: &'life2 MemoryFilter,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn rehearse_relations<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        triples: &'life1 [(String, String, String)],
        filter: &'life2 MemoryFilter,
        now: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filter: &'life1 MemoryFilter,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reset<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for graph storage backends.

Required Methods§

Source

fn add_entities<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, entities: &'life1 [Entity], filter: &'life2 MemoryFilter, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store extracted entities (provider may use this for node creation).

Source

fn add_relations<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, relations: &'life1 [Relation], entities: &'life2 [Entity], filter: &'life3 MemoryFilter, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Store extracted relations along with their entity metadata.

Source

fn search<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, filter: &'life2 MemoryFilter, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Text-based search for relations (legacy fallback).

Source

fn search_by_embedding<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, embedding: &'life1 [f32], filter: &'life2 MemoryFilter, threshold: f32, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<GraphSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Semantic search: find entities by embedding cosine similarity, then return all valid relations touching matched entities (1-hop traversal).

Source

fn invalidate_relations<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, triples: &'life1 [(String, String, String)], filter: &'life2 MemoryFilter, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Soft-delete relations by marking them as valid = false. Each tuple is (source, relationship, destination).

Source

fn rehearse_relations<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, triples: &'life1 [(String, String, String)], filter: &'life2 MemoryFilter, now: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Strengthen relations by updating last_accessed_at and incrementing mentions. Called asynchronously after successful search retrieval.

Source

fn delete_all<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 MemoryFilter, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete all relations matching the filter.

Source

fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove all data from the graph store.

Implementors§