Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore {
    // Required methods
    fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>;
    fn read_node(&self, id: Uuid) -> Result<Option<AinlMemoryNode>, String>;
    fn query_by_type(
        &self,
        type_name: &str,
    ) -> Result<Vec<AinlMemoryNode>, String>;
    fn query_recent_episodes(
        &self,
        agent_id: &str,
        limit: usize,
    ) -> Result<Vec<AinlMemoryNode>, String>;
    fn walk_edges(
        &self,
        from_id: Uuid,
        label: &str,
    ) -> Result<Vec<AinlMemoryNode>, String>;
}
Expand description

Graph memory storage - trait for swappable backends (Note: Send + Sync removed for spike - will use Arc<Mutex<>> in production)

Required Methods§

Source

fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>

Write a node to storage

Source

fn read_node(&self, id: Uuid) -> Result<Option<AinlMemoryNode>, String>

Read a node by ID

Source

fn query_by_type(&self, type_name: &str) -> Result<Vec<AinlMemoryNode>, String>

Query nodes by type

Source

fn query_recent_episodes( &self, agent_id: &str, limit: usize, ) -> Result<Vec<AinlMemoryNode>, String>

Query recent episodes for an agent

Source

fn walk_edges( &self, from_id: Uuid, label: &str, ) -> Result<Vec<AinlMemoryNode>, String>

Walk the graph from a starting node

Implementors§