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§
Sourcefn 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_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).
Sourcefn 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 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.
Sourcefn 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<'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).
Sourcefn 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 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).
Sourcefn 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 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).
Sourcefn 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 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.
Sourcefn 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 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.