TaskStepList
Class in Oadm.Sdk.Plugins · Oadm.Sdk.dll
The step list of one task: the state machine behind ITaskExecutionContext.PlanSteps and ITaskExecutionContext.BeginStep. Used by the server and usable by test fakes, so plugin tests see exactly the server’s step semantics. Thread-safe; TaskStepList.Changed is raised after every change, outside the lock.
public sealed class TaskStepListConstructors
Section titled “Constructors”TaskStepList
Section titled “TaskStepList”TaskStepList(TimeProvider? timeProvider = null, Action<string>? onWarning = null)Parameters
timeProvider: Clock for the step times; the system clock when null.onWarning: Called with the message ofITaskStep.Warn(the task warning).
Properties
Section titled “Properties”int Count { get; }Number of steps.
CurrentIndex
Section titled “CurrentIndex”int CurrentIndex { get; }Index of the running step; else of the last step that ended (the failed one of a failed task); -1 when no step started yet.
Progress
Section titled “Progress”int? Progress { get; }Overall progress derived from the steps (0-100): every finished step counts as one, the running one with its own progress. Null without steps.
Methods
Section titled “Methods”ITaskStep Begin(string name)Starts a step. A still running step is completed first. A pending (planned) step with this name is activated and moved before the other pending steps; otherwise a new step is inserted there.
void Close(bool succeeded, string skipReason)For hosts, when the task ends: a running step ends Done (succeeded) or Failed, pending steps become Skipped with skipReason. On success a final step TaskStepList.CompletedStepName (Done) is appended, also beyond TaskStepList.MaxSteps. Later changes are ignored.
CurrentIndexOf
Section titled “CurrentIndexOf”static int CurrentIndexOf(IReadOnlyList<TaskStepInfo> steps)The running step’s index; else the last step that started (the failed one of a failed task), else the last one that ended; -1 when there is none.
FailCurrent
Section titled “FailCurrent”bool FailCurrent(string message)For hosts, when the plugin threw: the running step, else the step just ended by Dispose, becomes Failed with message. Returns false when no step was affected.
void Plan(IEnumerable<string> names)Appends pending steps; names already pending are not added twice.
Snapshot
Section titled “Snapshot”IReadOnlyList<TaskStepInfo> Snapshot()Every step as it is now, in order.
Events
Section titled “Events”Changed
Section titled “Changed”event EventHandler? ChangedRaised after every change of a step.
Fields
Section titled “Fields”CompletedStepName
Section titled “CompletedStepName”const string CompletedStepName = "Completed"Name of the step TaskStepList.Close appends when a task succeeds (Done or Done with warnings), so the current step of a finished task reads “Completed”. Failed and cancelled tasks get none.
MaxDetailLength
Section titled “MaxDetailLength”const int MaxDetailLength = 1000Longer details are shortened.
MaxNameLength
Section titled “MaxNameLength”const int MaxNameLength = 200Longer step names are shortened.
MaxSteps
Section titled “MaxSteps”const int MaxSteps = 200Steps beyond this count are not recorded (their handles still work but change nothing).