Skip to main content

RunStore

Trait RunStore 

Source
pub trait RunStore: Send + Sync {
    // Required methods
    fn append_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: RunId,
        event: &'life1 Event,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 RunState,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_state<'life0, 'async_trait>(
        &'life0 self,
        run_id: RunId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<RunState>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Durable home for runs: an append-only event journal plus the latest state snapshot. The loop saves state after every turn and at every exit, so a crash loses at most the turn in flight.

This is the whole persistence contract the kernel needs. Domain data (memory, goals, people) belongs to the plugin crates that own it.

Required Methods§

Source

fn append_event<'life0, 'life1, 'async_trait>( &'life0 self, run_id: RunId, event: &'life1 Event, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn save_state<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 RunState, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn load_state<'life0, 'async_trait>( &'life0 self, run_id: RunId, ) -> Pin<Box<dyn Future<Output = Result<Option<RunState>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§