Class PipelineBase
- Namespace
- DuetControlServer.Codes.Pipelines
- Assembly
- DuetControlServer.dll
Abstract base class for pipeline elements
public abstract class PipelineBase
- Inheritance
-
PipelineBase
- Derived
- Inherited Members
Constructors
PipelineBase(PipelineStage, ChannelProcessor, CodeProcessor, IHostApplicationLifetime, IOptions<Settings>)
Constructor of this class
public PipelineBase(PipelineStage stage, ChannelProcessor channelProcessor, CodeProcessor codeProcessor, IHostApplicationLifetime lifetime, IOptions<Settings> settings)
Parameters
stagePipelineStageStage type
channelProcessorChannelProcessorChannel processor
codeProcessorCodeProcessorCode processor
lifetimeIHostApplicationLifetimeApplication lifetime
settingsIOptions<Settings>Application settings
Fields
ChannelProcessor
Corresponding channel processor
public readonly ChannelProcessor ChannelProcessor
Field Value
CodeProcessor
Code processor
public readonly CodeProcessor CodeProcessor
Field Value
Stage
Stage of this instance
public readonly PipelineStage Stage
Field Value
_baseItem
Base state of this pipeline
protected readonly PipelineStackItem _baseItem
Field Value
_stack
Stacks holding state information per input channel
protected readonly Stack<PipelineStackItem> _stack
Field Value
Properties
CurrentStackItem
Current item on the stack
public PipelineStackItem CurrentStackItem { get; }
Property Value
HasValidJobFile
Check if the pipeline has a valid job file
public bool HasValidJobFile { get; }
Property Value
Methods
Diagnostics(StringBuilder)
Get the diagnostics from this pipeline stage
public void Diagnostics(StringBuilder builder)
Parameters
builderStringBuilderString builder to write to
Exceptions
FlushAsync(Code, CancellationToken)
Wait for the pipeline stage to become idle
public virtual Task<bool> FlushAsync(Code code, CancellationToken cancellationToken = default)
Parameters
codeCodeCode waiting for the flush
cancellationTokenCancellationTokenOptional cancellation token
Returns
FlushAsync(CodeFile, CancellationToken)
Wait for the pipeline stage to become idle
public virtual Task<bool> FlushAsync(CodeFile file, CancellationToken cancellationToken = default)
Parameters
fileCodeFileCode file
cancellationTokenCancellationTokenOptional cancellation token
Returns
FlushAsync(bool, CancellationToken)
Wait for the first or current pipeline stack item to become idle
public virtual Task<bool> FlushAsync(bool flushAll, CancellationToken cancellationToken = default)
Parameters
flushAllboolFlush everything
cancellationTokenCancellationTokenOptional cancellation token
Returns
IsIdle(Code?)
Check if this stage is currently idle
public bool IsIdle(Code? code)
Parameters
codeCodeOptional code requesting the check
Returns
- bool
Whether this pipeline stage is idle
Pop()
Pop the last element from the stack
public virtual void Pop()
Exceptions
- ArgumentException
Failed to pop last element
ProcessCodeAsync(Code)
Process a code from a given code channel
public abstract Task ProcessCodeAsync(Code code)
Parameters
codeCodeCode to process
Returns
- Task
Asynchronous task
Push(CodeFile?)
Push a new element onto the stack
public virtual PipelineStackItem Push(CodeFile? file)
Parameters
fileCodeFileCode file or null if waiting for acknowledgment
Returns
SetJobFile(CodeFile?)
Set the job file
public void SetJobFile(CodeFile? file)
Parameters
fileCodeFile
WaitForCompletionAsync()
Wait for the processor tasks to complete
public Task WaitForCompletionAsync()
Returns
- Task
Asynchronous tasks
WriteCode(Code)
Enqueue a given code on this pipeline state for execution. This should not be used unless the corresponding code channel is unbounded
public virtual void WriteCode(Code code)
Parameters
codeCodeCode to enqueue
WriteCodeAsync(Code)
Enqueue a given code asynchronously on this pipeline state for execution
public virtual ValueTask WriteCodeAsync(Code code)
Parameters
codeCodeCode to enqueue
Returns
- ValueTask
Asynchronous task