Table of Contents

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

stage PipelineStage

Stage type

channelProcessor ChannelProcessor

Channel processor

codeProcessor CodeProcessor

Code processor

lifetime IHostApplicationLifetime

Application lifetime

settings IOptions<Settings>

Application settings

Fields

ChannelProcessor

Corresponding channel processor

public readonly ChannelProcessor ChannelProcessor

Field Value

ChannelProcessor

CodeProcessor

Code processor

public readonly CodeProcessor CodeProcessor

Field Value

CodeProcessor

Stage

Stage of this instance

public readonly PipelineStage Stage

Field Value

PipelineStage

_baseItem

Base state of this pipeline

protected readonly PipelineStackItem _baseItem

Field Value

PipelineStackItem

_stack

Stacks holding state information per input channel

protected readonly Stack<PipelineStackItem> _stack

Field Value

Stack<PipelineStackItem>

Properties

CurrentStackItem

Current item on the stack

public PipelineStackItem CurrentStackItem { get; }

Property Value

PipelineStackItem

HasValidJobFile

Check if the pipeline has a valid job file

public bool HasValidJobFile { get; }

Property Value

bool

Methods

Diagnostics(StringBuilder)

Get the diagnostics from this pipeline stage

public void Diagnostics(StringBuilder builder)

Parameters

builder StringBuilder

String builder to write to

Exceptions

NotImplementedException

FlushAsync(Code, CancellationToken)

Wait for the pipeline stage to become idle

public virtual Task<bool> FlushAsync(Code code, CancellationToken cancellationToken = default)

Parameters

code Code

Code waiting for the flush

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<bool>

Whether the codes have been flushed successfully

FlushAsync(CodeFile, CancellationToken)

Wait for the pipeline stage to become idle

public virtual Task<bool> FlushAsync(CodeFile file, CancellationToken cancellationToken = default)

Parameters

file CodeFile

Code file

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<bool>

Whether the codes have been flushed successfully

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

flushAll bool

Flush everything

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<bool>

IsIdle(Code?)

Check if this stage is currently idle

public bool IsIdle(Code? code)

Parameters

code Code

Optional 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

code Code

Code to process

Returns

Task

Asynchronous task

Push(CodeFile?)

Push a new element onto the stack

public virtual PipelineStackItem Push(CodeFile? file)

Parameters

file CodeFile

Code file or null if waiting for acknowledgment

Returns

PipelineStackItem

SetJobFile(CodeFile?)

Set the job file

public void SetJobFile(CodeFile? file)

Parameters

file CodeFile

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

code Code

Code to enqueue

WriteCodeAsync(Code)

Enqueue a given code asynchronously on this pipeline state for execution

public virtual ValueTask WriteCodeAsync(Code code)

Parameters

code Code

Code to enqueue

Returns

ValueTask

Asynchronous task