Table of Contents

Class PipelineBuilderExtensions

Namespace
CounterpointCollective.Dataflow.Fluent
Assembly
Dataflow.Fluent.dll
public static class PipelineBuilderExtensions
Inheritance
PipelineBuilderExtensions
Inherited Members

Methods

Action<TFirst, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Action<T>, ExecutionDataflowBlockOptions?)

Links an ActionBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ActionBlock<T>> Action<TFirst, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Action<T> a, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
a Action<T>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, ActionBlock<T>>

Type Parameters

TFirst
T

Batch<TFirst, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, int, GroupingDataflowBlockOptions?)

Links a BatchBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, BatchBlock<T>> Batch<TFirst, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, int batchSize, GroupingDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
batchSize int
options GroupingDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, BatchBlock<T>>

Type Parameters

TFirst
T

Buffer<TFirst, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, DataflowBlockOptions?)

Links a BufferBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, BufferBlock<T>> Buffer<TFirst, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, DataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>

The pipeline builder.

options DataflowBlockOptions

Optional DataflowBlockOptions.

Returns

IPipelineBuilder<TFirst, BufferBlock<T>>

A pipeline builder ending with a BufferBlock of T.

Type Parameters

TFirst

The first block type.

T

The type of items in the buffer.

BuildDataflowBlock<TInput>(IPipelineBuilder<IDataflowBlock, IDataflowBlock>)

Builds the pipeline as a single IDataflowBlock

public static IDataflowBlock BuildDataflowBlock<TInput>(this IPipelineBuilder<IDataflowBlock, IDataflowBlock> b)

Parameters

b IPipelineBuilder<IDataflowBlock, IDataflowBlock>

Returns

IDataflowBlock

A block that encapsulates the entire pipeline.

Type Parameters

TInput

BuildSourceBlock<TOutput>(IPipelineBuilder<IDataflowBlock, ISourceBlock<TOutput>>)

Builds the encapsulated pipeline as a single ISourceBlock<TOutput>

public static ISourceBlock<TOutput> BuildSourceBlock<TOutput>(this IPipelineBuilder<IDataflowBlock, ISourceBlock<TOutput>> b)

Parameters

b IPipelineBuilder<IDataflowBlock, ISourceBlock<TOutput>>

Returns

ISourceBlock<TOutput>

A block that encapsulates the entire pipeline.

Type Parameters

TOutput

BuildTargetBlock<TInput>(IPipelineBuilder<ITargetBlock<TInput>, IDataflowBlock>)

Builds the pipeline as a single ITargetBlock<TInput>

public static ITargetBlock<TInput> BuildTargetBlock<TInput>(this IPipelineBuilder<ITargetBlock<TInput>, IDataflowBlock> b)

Parameters

b IPipelineBuilder<ITargetBlock<TInput>, IDataflowBlock>

Returns

ITargetBlock<TInput>

A block that encapsulates the entire pipeline.

Type Parameters

TInput

Build<TInput, TOutput>(IPipelineBuilder<ITargetBlock<TInput>, ISourceBlock<TOutput>>)

Builds the pipeline as a single IPropagatorBlock<TInput, TOutput>

public static IPropagatorBlock<TInput, TOutput> Build<TInput, TOutput>(this IPipelineBuilder<ITargetBlock<TInput>, ISourceBlock<TOutput>> b)

Parameters

b IPipelineBuilder<ITargetBlock<TInput>, ISourceBlock<TOutput>>

Returns

IPropagatorBlock<TInput, TOutput>

A block that encapsulates the entire pipeline.

Type Parameters

TInput
TOutput

LinkTo<TFirst, TNewLast, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, TNewLast, DataflowLinkOptions)

public static IPipelineBuilder<TFirst, TNewLast> LinkTo<TFirst, TNewLast, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, TNewLast nl, DataflowLinkOptions options) where TFirst : IDataflowBlock where TNewLast : ITargetBlock<T>

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
nl TNewLast
options DataflowLinkOptions

Returns

IPipelineBuilder<TFirst, TNewLast>

Type Parameters

TFirst
TNewLast
T

LinkTo<TFirst, TNewLast, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, TNewLast, DataflowLinkOptions, Predicate<T>)

public static IPipelineBuilder<TFirst, TNewLast> LinkTo<TFirst, TNewLast, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, TNewLast nl, DataflowLinkOptions options, Predicate<T> predicate) where TFirst : IDataflowBlock where TNewLast : ITargetBlock<T>

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
nl TNewLast
options DataflowLinkOptions
predicate Predicate<T>

Returns

IPipelineBuilder<TFirst, TNewLast>

Type Parameters

TFirst
TNewLast
T

Pipeline<TBlock>(TBlock)

Create a IPipelineBuilder wrapping the given dataflow block.

public static IPipelineBuilder<TBlock, TBlock> Pipeline<TBlock>(this TBlock block) where TBlock : IDataflowBlock

Parameters

block TBlock

The dataflow block wrap by the IPipelineBuilder.

Returns

IPipelineBuilder<TBlock, TBlock>

A new IPipelineBuilder<TFirst, TLast> representing the pipeline starting and ending with block. This allows additional blocks to be appended fluently to build a larger pipeline, e.g. using methods like Transform or Tee.

Type Parameters

TBlock

The type of the dataflow block.

SelectFirst<TFirst, TLast, TNew>(IPipelineBuilder<TFirst, TLast>, Func<TFirst, TNew>)

public static IPipelineBuilder<TNew, TLast> SelectFirst<TFirst, TLast, TNew>(this IPipelineBuilder<TFirst, TLast> p, Func<TFirst, TNew> f) where TFirst : IDataflowBlock where TLast : IDataflowBlock where TNew : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, TLast>
f Func<TFirst, TNew>

Returns

IPipelineBuilder<TNew, TLast>

Type Parameters

TFirst
TLast
TNew

SelectLast<TFirst, TLast, TNew>(IPipelineBuilder<TFirst, TLast>, Func<TLast, TNew>)

public static IPipelineBuilder<TFirst, TNew> SelectLast<TFirst, TLast, TNew>(this IPipelineBuilder<TFirst, TLast> p, Func<TLast, TNew> f) where TFirst : IDataflowBlock where TLast : IDataflowBlock where TNew : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, TLast>
f Func<TLast, TNew>

Returns

IPipelineBuilder<TFirst, TNew>

Type Parameters

TFirst
TLast
TNew

Select<TFirst, TLast, TNewFirst, TNewLast>(IPipelineBuilder<TFirst, TLast>, Func<IPipelineBuilder<TFirst, TLast>, IPipelineBuilder<TNewFirst, TNewLast>>)

public static IPipelineBuilder<TNewFirst, TNewLast> Select<TFirst, TLast, TNewFirst, TNewLast>(this IPipelineBuilder<TFirst, TLast> p, Func<IPipelineBuilder<TFirst, TLast>, IPipelineBuilder<TNewFirst, TNewLast>> f) where TFirst : IDataflowBlock where TLast : IDataflowBlock where TNewFirst : IDataflowBlock where TNewLast : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, TLast>
f Func<IPipelineBuilder<TFirst, TLast>, IPipelineBuilder<TNewFirst, TNewLast>>

Returns

IPipelineBuilder<TNewFirst, TNewLast>

Type Parameters

TFirst
TLast
TNewFirst
TNewLast

SubPipeline<TFirst, TLast, TNewLast>(IPipelineBuilder<TFirst, TLast>, Func<IPipelineBuilder<TLast, TLast>, TNewLast>)

Builds a sub-pipeline starting from the current last block and replaces the last block with the result of that sub-pipeline.

public static IPipelineBuilder<TFirst, TNewLast> SubPipeline<TFirst, TLast, TNewLast>(this IPipelineBuilder<TFirst, TLast> p, Func<IPipelineBuilder<TLast, TLast>, TNewLast> build) where TFirst : IDataflowBlock where TLast : IDataflowBlock where TNewLast : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, TLast>

The current pipeline builder.

build Func<IPipelineBuilder<TLast, TLast>, TNewLast>

A function that receives a sub-pipeline starting at TLast and returns its final block.

Returns

IPipelineBuilder<TFirst, TNewLast>

A new pipeline builder whose last block is the result of the sub-pipeline.

Type Parameters

TFirst

The first block type of the outer pipeline.

TLast

The current last block type, used as the start of the sub-pipeline.

TNewLast

The resulting last block type after the sub-pipeline.

TransformMany<TFirst, I, O>(IPipelineBuilder<TFirst, ISourceBlock<I>>, Func<I, IAsyncEnumerable<O>>, ExecutionDataflowBlockOptions?)

Links a TransformManyBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, TransformManyBlock<I, O>> TransformMany<TFirst, I, O>(this IPipelineBuilder<TFirst, ISourceBlock<I>> p, Func<I, IAsyncEnumerable<O>> f, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<I>>
f Func<I, IAsyncEnumerable<O>>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, TransformManyBlock<I, O>>

Type Parameters

TFirst
I
O

TransformMany<TFirst, I, O>(IPipelineBuilder<TFirst, ISourceBlock<I>>, Func<I, IEnumerable<O>>, ExecutionDataflowBlockOptions?)

Links a TransformManyBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, TransformManyBlock<I, O>> TransformMany<TFirst, I, O>(this IPipelineBuilder<TFirst, ISourceBlock<I>> p, Func<I, IEnumerable<O>> f, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<I>>
f Func<I, IEnumerable<O>>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, TransformManyBlock<I, O>>

Type Parameters

TFirst
I
O

TransformMany<TFirst, I, O>(IPipelineBuilder<TFirst, ISourceBlock<I>>, Func<I, Task<IEnumerable<O>>>, ExecutionDataflowBlockOptions?)

Links a TransformManyBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, TransformManyBlock<I, O>> TransformMany<TFirst, I, O>(this IPipelineBuilder<TFirst, ISourceBlock<I>> p, Func<I, Task<IEnumerable<O>>> f, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<I>>
f Func<I, Task<IEnumerable<O>>>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, TransformManyBlock<I, O>>

Type Parameters

TFirst
I
O

Transform<TFirst, I, O>(IPipelineBuilder<TFirst, ISourceBlock<I>>, Func<I, O>, ExecutionDataflowBlockOptions?)

Links a TransformBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, TransformBlock<I, O>> Transform<TFirst, I, O>(this IPipelineBuilder<TFirst, ISourceBlock<I>> p, Func<I, O> f, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<I>>
f Func<I, O>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, TransformBlock<I, O>>

Type Parameters

TFirst
I
O