initialize method

Future<void> initialize()

Loads existing checkpoints from the store for replay.

Must be called before the first executeStep call. Checkpoints are loaded and used for replay detection, but the step counter remains at 0 since the workflow body will call steps in order from the beginning.

Implementation

Future<void> initialize() async {
  final checkpoints = await _store.loadCheckpoints(_workflowExecutionId);
  _completedByIndex = {
    for (final cp in checkpoints)
      if (cp.status == StepStatus.completed) cp.stepIndex: cp,
  };
}