Table of Contents

Class PipelineStackItem

Namespace
DuetControlServer.Codes.Pipelines
Assembly
DuetControlServer.dll

Class representing an execution level on a given pipeline. This is the effective target for incoming codes

public sealed class PipelineStackItem
Inheritance
PipelineStackItem
Inherited Members

Constructors

PipelineStackItem(PipelineBase, CodeFile?, CodeProcessor, Settings, IHostApplicationLifetime)

Constructor of this class

public PipelineStackItem(PipelineBase pipeline, CodeFile? file, CodeProcessor codeProcessor, Settings settings, IHostApplicationLifetime lifetime)

Parameters

pipeline PipelineBase

Pipeline holding this stack item

file CodeFile

Current file or null if not present

codeProcessor CodeProcessor

Code processor

settings Settings

Settings to use

lifetime IHostApplicationLifetime

Host application lifetime

Fields

CodeBeingExecuted

Current code being executed. This is not applicable on the Firmware stage because we buffer multiple codes there

public Code? CodeBeingExecuted

Field Value

Code

File

Code file corresponding to this stack item

public CodeFile? File

Field Value

CodeFile

PendingCodes

Pending codes to be executed

public readonly Channel<Code> PendingCodes

Field Value

Channel<Code>

ProcessorTask

Internal task processing incoming codes

public readonly Task ProcessorTask

Field Value

Task

Properties

Busy

Indicates if the pipeline state is busy processing codes

public bool Busy { get; set; }

Property Value

bool

Methods

FlushAsync(CancellationToken)

Wait for the pipeline state to finish processing codes

public Task<bool> FlushAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Optional cancellation token

Returns

Task<bool>

Whether the codes have been flushed successfully

Remarks

This method does not throw an exception even if the cancellation token is triggered

WriteCode(Code)

Enqueue a given code on this pipeline state for execution

public void WriteCode(Code code)

Parameters

code Code

Code to enqueue

WriteCodeAsync(Code, CancellationToken)

Enqueue a given code asynchrously on this pipeline state for execution

public ValueTask WriteCodeAsync(Code code, CancellationToken cancellationToken = default)

Parameters

code Code

Code to enqueue

cancellationToken CancellationToken

Optional cancellation token

Returns

ValueTask

Asynchronous task