Skip to main content

WorkflowStore

Trait WorkflowStore 

Source
pub trait WorkflowStore: Send + Sync {
    // Required methods
    fn create_run<'life0, 'async_trait>(
        &'life0 self,
        state: WorkflowExecutionState,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowExecutionState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_context<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
        context: Value,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn upsert_step<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
        step: WorkflowStepState,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_step<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
        step_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowStepState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_steps<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_task_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<WorkflowStepState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persist and load workflow execution state. One trait, both run-level and step-level CRUD — keeps orchestrator wiring to a single field. Implementations: in-memory (tests + OSS server-cli), Redis (cloud).

Required Methods§

Source

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

Insert a new run record. Existing record under the same run_task_id is overwritten (treat the call as create-or-resume).

Source

fn get_run<'life0, 'life1, 'async_trait>( &'life0 self, run_task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowExecutionState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the run-level state for a workflow.

Source

fn update_context<'life0, 'life1, 'async_trait>( &'life0 self, run_task_id: &'life1 str, context: Value, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the shared context bag (called after step results merge in). Other run-level fields are immutable for the life of the run.

Source

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

Drop a run and all its step rows.

Source

fn upsert_step<'life0, 'life1, 'async_trait>( &'life0 self, run_task_id: &'life1 str, step: WorkflowStepState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert or update one step’s state under a run.

Source

fn get_step<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, run_task_id: &'life1 str, step_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowStepState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Load one step’s state.

Source

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

List all step states for a run, in insertion order.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§