Interface IFlowRunRuntimeStore
- Namespace
- FlowOrchestrator.Core.Storage
- Assembly
- FlowOrchestrator.Core.dll
Runtime step-tracking store used by the orchestrator during execution to prevent duplicate step enqueuing in parallel/fan-out scenarios.
public interface IFlowRunRuntimeStore
Methods
GetClaimedStepKeysAsync(Guid)
Returns the set of step keys that have been claimed (locked) for execution but not yet completed, used to detect in-progress steps.
Task<IReadOnlyCollection<string>> GetClaimedStepKeysAsync(Guid runId)
Parameters
runIdGuid
Returns
GetRunStatusAsync(Guid)
Returns the current overall status of the run ("Running", "Succeeded", etc.),
or null if the run does not exist.
Task<string?> GetRunStatusAsync(Guid runId)
Parameters
runIdGuid
Returns
GetStepStatusesAsync(Guid)
Returns the current StepStatus for every step in the run.
Task<IReadOnlyDictionary<string, StepStatus>> GetStepStatusesAsync(Guid runId)
Parameters
runIdGuid
Returns
RecordSkippedStepAsync(Guid, string, string, string?)
Records a step as Skipped without executing it,
used when runAfter conditions cannot be satisfied.
Task RecordSkippedStepAsync(Guid runId, string stepKey, string stepType, string? reason)
Parameters
Returns
RecordSkippedStepAsync(Guid, string, string, string?, string?)
Records a step as Skipped and persists a
WhenEvaluationTrace describing why a When
clause evaluated to false.
Task RecordSkippedStepAsync(Guid runId, string stepKey, string stepType, string? reason, string? evaluationTraceJson)
Parameters
Returns
Remarks
Default implementation falls back to RecordSkippedStepAsync(Guid, string, string, string?) so existing custom storage providers continue to compile without modification.
ReleaseStepClaimAsync(Guid, string)
Releases a previously-acquired step claim so a future TryClaimStepAsync(Guid, string) for the
same (runId, stepKey) can succeed. Called by the engine on Pending re-schedule and
retry paths, where the same logical step needs to run again.
Task ReleaseStepClaimAsync(Guid runId, string stepKey)
Parameters
Returns
Remarks
Idempotent — calling for a key with no claim is a no-op. Default implementation is a no-op so existing custom runtime stores continue to compile; in that case retry/Pending paths behave as before v1.22 (the schedule-time claim was non-strict). New implementations should remove the claim row atomically.
TryClaimStepAsync(Guid, string)
Atomically claims a step for execution, returning true if this caller acquired the claim or false if another worker already claimed it.
Task<bool> TryClaimStepAsync(Guid runId, string stepKey)
Parameters
Returns
Remarks
This is the primary guard against duplicate step execution. Since v1.22 the engine calls
this at the top of RunStepAsync (execute time) rather than at schedule time, so it
correctly prevents concurrent execution under at-least-once delivery — including the
Service Bus topic-broadcast case where a single dispatched message reaches multiple
subscriptions. Implementations must use an atomic compare-and-set or equivalent database
primitive. Pair with ReleaseStepClaimAsync(Guid, string) on retry / Pending
re-schedule paths so the SAME step can claim again on a fresh attempt.