Skip to main content

TaskStateStore

Trait TaskStateStore 

Source
pub trait TaskStateStore: Send + Sync {
    // Required methods
    fn save_state<'life0, 'async_trait>(
        &'life0 self,
        state: PersistedTaskState,
    ) -> Pin<Box<dyn Future<Output = SupervisorResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = SupervisorResult<Option<PersistedTaskState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_all_states<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SupervisorResult<Vec<PersistedTaskState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = SupervisorResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for components that persist task state

Required Methods§

Source

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

Save the state of a task

Source

fn load_state<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = SupervisorResult<Option<PersistedTaskState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the state of a task by ID

Source

fn load_all_states<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SupervisorResult<Vec<PersistedTaskState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all saved task states

Source

fn delete_state<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = SupervisorResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete the state of a task

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§