Class ProtoFlow
A named, traced sequence of steps: each step is one operation whose outcome is derived, and the flow either stops at the first failure or collects every failure. This is the shared sequence primitive for lifecycle phases and teardown chains, so a release chain reads as a list of steps instead of a loop, an exception list and a tracing helper.
public sealed class ProtoFlow
- Inheritance
-
ProtoFlow
- Inherited Members
- Extension Methods
Constructors
ProtoFlow(string, string, ProtoFlowFailureMode)
public ProtoFlow(string name, string source, ProtoFlowFailureMode failureMode = ProtoFlowFailureMode.FailFast)
Parameters
namestringsourcestringfailureModeProtoFlowFailureMode
Methods
RunAsync(IProtoTraceWriter, CancellationToken)
Runs the steps in order. Cancelling the flow's token always stops the flow and propagates; in collect mode a step that cancels for any other reason is recorded like any failure and the remaining steps still run, so teardown never skips cleanup. Step failures are returned in Failures, so the caller decides whether to throw.
public ValueTask<ProtoFlowResult> RunAsync(IProtoTraceWriter trace, CancellationToken cancellationToken = default)
Parameters
traceIProtoTraceWritercancellationTokenCancellationToken
Returns
Step(ProtoStepDescriptor, Func<CancellationToken, ValueTask>)
Appends a step traced as the operation the descriptor declares.
public ProtoFlow Step(ProtoStepDescriptor step, Func<CancellationToken, ValueTask> action)
Parameters
stepProtoStepDescriptoractionFunc<CancellationToken, ValueTask>
Returns
Step(string, Func<CancellationToken, ValueTask>)
Appends a step traced as the generic flow.step operation.
public ProtoFlow Step(string name, Func<CancellationToken, ValueTask> action)
Parameters
namestringactionFunc<CancellationToken, ValueTask>