pub trait GraphStore: Send + Sync {
// Required methods
fn upsert_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity: &'life1 Entity,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upsert_relationship<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 Relationship,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn invalidate_relationship<'life0, 'async_trait>(
&'life0 self,
id: RelationshipId,
invalid_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_entity<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn neighbors<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
depth: u8,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<SubGraph, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search_entities<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_by_scope<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 Scope,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Storage interface for the entity-relationship knowledge graph.
All mutation methods are fallible and return Result<_, MemoryError>.
Temporal queries use RFC 3339 DateTime<Utc> values for point-in-time
filtering consistent with FactStore semantics.
Required Methods§
Sourcefn upsert_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity: &'life1 Entity,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity: &'life1 Entity,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Insert or update an entity.
If an entity with entity.id already exists, its name, entity_type,
attributes, and updated_at fields are overwritten. Scope and
created_at are preserved.
Sourcefn upsert_relationship<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 Relationship,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert_relationship<'life0, 'life1, 'async_trait>(
&'life0 self,
rel: &'life1 Relationship,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Insert or update a relationship.
If a relationship with rel.id already exists, its relation and
invalid_at fields are overwritten.
Sourcefn invalidate_relationship<'life0, 'async_trait>(
&'life0 self,
id: RelationshipId,
invalid_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invalidate_relationship<'life0, 'async_trait>(
&'life0 self,
id: RelationshipId,
invalid_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a relationship as invalid as of invalid_at.
Does not delete the record; historical graph queries still traverse it.
Sourcefn get_entity<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_entity<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a single entity by id. Returns None if not found.
Sourcefn neighbors<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
depth: u8,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<SubGraph, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn neighbors<'life0, 'async_trait>(
&'life0 self,
id: EntityId,
depth: u8,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<SubGraph, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
BFS neighbourhood query starting from id.
Expands up to depth hops along currently-valid relationships. When
as_of is Some(t), a relationship is considered valid if
valid_from <= t AND (invalid_at IS NULL OR invalid_at > t). When
as_of is None, only relationships with invalid_at IS NULL are
traversed.
Returns a SubGraph containing all discovered entities (excluding the
start node) and the relationships that connect them.
Sourcefn search_entities<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_entities<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Full-text search over entity names.
Returns up to top_k entities whose name contains query
(case-insensitive substring match).
Sourcefn delete_by_scope<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 Scope,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_by_scope<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 Scope,
) -> Pin<Box<dyn Future<Output = Result<u64, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Hard-delete all entities and relationships belonging to scope.
Relationships are deleted first to avoid foreign-key-style dangling references. Returns the total number of rows deleted (entities + relationships combined).