Skip to main content

materialize

Function materialize 

Source
pub async fn materialize(
    backend: &dyn StateBackend,
    execution_id: &ExecutionId,
) -> Result<MaterializedState, StateBackendError>
Expand description

Reconstruct the current workflow state from the event log.

Algorithm:

  1. Load the latest snapshot (if any). If none, start from the initial_input.
  2. Load all events since the snapshot’s at_sequence.
  3. Apply state patches from NodeCompleted events in order.
  4. Derive status, completed_nodes, and active_nodes from all events.