Skip to main content

GraphStorage

Trait GraphStorage 

Source
pub trait GraphStorage: Storage {
    // Required methods
    fn upsert_entity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        entity: &'life1 EntityData,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_entity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<EntityData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_entities<'life0, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EntityData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_entity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_relationship<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        relationship: &'life1 EntityRelationship,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_related_entities<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        entity_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_related_by_type<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        entity_name: &'life1 str,
        relation_type: &'life2 RelationType,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn find_shortest_path<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        from: &'life1 str,
        to: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_entity_network<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: Uuid,
        center: &'life1 str,
        max_depth: usize,
    ) -> Pin<Box<dyn Future<Output = Result<EntityNetwork>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Extended storage trait for graph-native operations.

This trait is implemented by backends with native graph support (e.g., SurrealDB). For backends without native graph support (e.g., RocksDB), graph operations are handled by the in-memory SimpleEntityGraph.

Required Methods§

Source

fn upsert_entity<'life0, 'life1, 'async_trait>( &'life0 self, session_id: Uuid, entity: &'life1 EntityData, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert or update an entity

Source

fn get_entity<'life0, 'life1, 'async_trait>( &'life0 self, session_id: Uuid, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<EntityData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get an entity by name

Source

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

List all entities for a session

Source

fn delete_entity<'life0, 'life1, 'async_trait>( &'life0 self, session_id: Uuid, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete an entity

Source

fn create_relationship<'life0, 'life1, 'async_trait>( &'life0 self, session_id: Uuid, relationship: &'life1 EntityRelationship, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a relationship between entities

Find all entities related to a given entity

Find entities related by a specific relation type

Source

fn find_shortest_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: Uuid, from: &'life1 str, to: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Find the shortest path between two entities

Source

fn get_entity_network<'life0, 'life1, 'async_trait>( &'life0 self, session_id: Uuid, center: &'life1 str, max_depth: usize, ) -> Pin<Box<dyn Future<Output = Result<EntityNetwork>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the entity network (subgraph) around a center entity

Implementors§