Skip to main content

ColdStorage

Trait ColdStorage 

Source
pub trait ColdStorage: Send + Sync {
    // Required methods
    fn archive<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 MemoryRecord,
    ) -> Pin<Box<dyn Future<Output = Result<ArchiveResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn restore<'life0, 'async_trait>(
        &'life0 self,
        memory_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<RestoreResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_archived<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: Option<&'life1 str>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_archived<'life0, 'async_trait>(
        &'life0 self,
        memory_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_archived<'life0, 'async_trait>(
        &'life0 self,
        memory_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for cold storage backends.

Implementations handle archiving memory records to durable object storage (e.g., S3, MinIO, GCS) and restoring them on demand.

Required Methods§

Source

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

Archive a memory record to cold storage.

Serializes the record to JSON and writes it to the configured bucket under the key {prefix}/{agent_id}/{memory_id}.json.

Source

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

Restore a memory from cold storage by ID.

Returns an error if the memory is not found in cold storage.

Source

fn list_archived<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: Option<&'life1 str>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List archived memory IDs with optional agent filter.

If agent_id is provided, only memories belonging to that agent are returned. Results are capped at limit.

Source

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

Delete an archived memory permanently.

Returns an error if the memory is not found in cold storage.

Source

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

Check if a memory is archived.

Implementors§