Skip to main content

MemoryStorage

Trait MemoryStorage 

Source
pub trait MemoryStorage: Send + Sync {
    // Required methods
    fn save_json_value<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        category: &'life1 str,
        key: &'life2 str,
        value: &'life3 Value,
    ) -> 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 load_json_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        category: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_category<'life0, 'life1, 'async_trait>(
        &'life0 self,
        category: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        category: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Persistent storage backend for memory entries.

Implemented by oxios-kernel::StateStore (file-based) and can be implemented by any other storage backend.

The core trait methods operate on serde_json::Value to remain dyn-compatible. Typed convenience helpers are provided as default methods that serialize/deserialize through Value.

Required Methods§

Source

fn save_json_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 Value, ) -> 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,

Save a JSON value to a category/key.

Source

fn load_json_value<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Load a JSON value from a category/key.

Source

fn list_category<'life0, 'life1, 'async_trait>( &'life0 self, category: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all keys in a category.

Source

fn delete_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, category: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a file by category/key. Returns true if the file existed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§