Table of Contents

Class PipelineBuilderExtensions

Namespace
CounterpointCollective.Dataflow.Fluent
Assembly
Dataflow.Composable.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>>
options DataflowBlockOptions

Returns

IPipelineBuilder<TFirst, BufferBlock<T>>

Type Parameters

TFirst
T

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

Choice<TFirst, T, O>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Predicate<T>, IPropagatorBlock<T, O>, IPropagatorBlock<T, O>, ExecutionDataflowBlockOptions?)

Links an choice block to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ChoiceBlock<T, O>> Choice<TFirst, T, O>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Predicate<T> predicate, IPropagatorBlock<T, O> thenBlock, IPropagatorBlock<T, O> elseBlock, ExecutionDataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
predicate Predicate<T>
thenBlock IPropagatorBlock<T, O>
elseBlock IPropagatorBlock<T, O>
options ExecutionDataflowBlockOptions

Returns

IPipelineBuilder<TFirst, ChoiceBlock<T, O>>

Type Parameters

TFirst
T
O

GroupAdjacent<TFirst, T, TKey>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Func<T, TKey>, ExecutionDataflowBlockOptions, bool)

Links an GroupAdjacentBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, GroupAdjacentBlock<T, TKey, T>> GroupAdjacent<TFirst, T, TKey>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Func<T, TKey> keySelector, ExecutionDataflowBlockOptions options, bool flushOnIdle = false) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
keySelector Func<T, TKey>
options ExecutionDataflowBlockOptions
flushOnIdle bool

Returns

IPipelineBuilder<TFirst, GroupAdjacentBlock<T, TKey, T>>

Type Parameters

TFirst
T
TKey

GroupAdjacent<TFirst, T, TKey, TValue>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Func<T, TKey>, Func<T, TValue>, ExecutionDataflowBlockOptions, bool)

Links an GroupAdjacentBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, GroupAdjacentBlock<T, TKey, TValue>> GroupAdjacent<TFirst, T, TKey, TValue>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Func<T, TKey> keySelector, Func<T, TValue> valueSelector, ExecutionDataflowBlockOptions options, bool flushOnIdle = false) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
keySelector Func<T, TKey>
valueSelector Func<T, TValue>
options ExecutionDataflowBlockOptions
flushOnIdle bool

Returns

IPipelineBuilder<TFirst, GroupAdjacentBlock<T, TKey, TValue>>

Type Parameters

TFirst
T
TKey
TValue

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

Parallel<TFirst, TOutput>(IPipelineBuilder<TFirst, ISourceBlock<TOutput>>, IPropagatorBlock<TOutput, TOutput>[], GuaranteedBroadcastBlockOptions?)

Links a ParallelBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ISourceBlock<TOutput>> Parallel<TFirst, TOutput>(this IPipelineBuilder<TFirst, ISourceBlock<TOutput>> p, IPropagatorBlock<TOutput, TOutput>[] blocks, GuaranteedBroadcastBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<TOutput>>
blocks IPropagatorBlock<TOutput, TOutput>[]
options GuaranteedBroadcastBlockOptions

Returns

IPipelineBuilder<TFirst, ISourceBlock<TOutput>>

Type Parameters

TFirst
TOutput

Parallel<TFirst, TInput, T1, T2, TOutput>(IPipelineBuilder<TFirst, ISourceBlock<TInput>>, IPropagatorBlock<TInput, T1>, IPropagatorBlock<TInput, T2>, Func<T1, T2, TOutput>, GuaranteedBroadcastBlockOptions?)

Links a ParallelBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ISourceBlock<TOutput>> Parallel<TFirst, TInput, T1, T2, TOutput>(this IPipelineBuilder<TFirst, ISourceBlock<TInput>> p, IPropagatorBlock<TInput, T1> block1, IPropagatorBlock<TInput, T2> block2, Func<T1, T2, TOutput> f, GuaranteedBroadcastBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<TInput>>
block1 IPropagatorBlock<TInput, T1>
block2 IPropagatorBlock<TInput, T2>
f Func<T1, T2, TOutput>
options GuaranteedBroadcastBlockOptions

Returns

IPipelineBuilder<TFirst, ISourceBlock<TOutput>>

Type Parameters

TFirst
TInput
T1
T2
TOutput

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.

ResizableBuffer<TFirst, TOutput>(IPipelineBuilder<TFirst, ISourceBlock<TOutput>>, DataflowBlockOptions?, Action?)

Links a ResizableBuffer to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ResizableBufferBlock<TOutput>> ResizableBuffer<TFirst, TOutput>(this IPipelineBuilder<TFirst, ISourceBlock<TOutput>> p, DataflowBlockOptions? options = null, Action? onEntered = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<TOutput>>
options DataflowBlockOptions
onEntered Action

Returns

IPipelineBuilder<TFirst, ResizableBufferBlock<TOutput>>

Type Parameters

TFirst
TOutput

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.

SynchronousFilter<TFirst, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Predicate<T>, FilterMode)

Wraps the last block of the current IPipelineBuilder in a SynchronousFilterBlock.

public static IPipelineBuilder<TFirst, SynchronousFilterBlock<T>> SynchronousFilter<TFirst, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Predicate<T> predicate, FilterMode mode = FilterMode.Block) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
predicate Predicate<T>
mode FilterMode

Returns

IPipelineBuilder<TFirst, SynchronousFilterBlock<T>>

Type Parameters

TFirst
T

SynchronousTransform<TFirst, T, O>(IPipelineBuilder<TFirst, ISourceBlock<T>>, Func<T, O>)

Wraps the last block of the current IPipelineBuilder in a SynchronousTransformingBlock.

public static IPipelineBuilder<TFirst, SynchronousTransformingBlock<T, O>> SynchronousTransform<TFirst, T, O>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, Func<T, O> transform) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
transform Func<T, O>

Returns

IPipelineBuilder<TFirst, SynchronousTransformingBlock<T, O>>

Type Parameters

TFirst
T
O

Tee<TFirst, I, T, O>(IPipelineBuilder<TFirst, ISourceBlock<I>>, IPropagatorBlock<I, T>, Func<I, T, O>, DataflowBlockOptions?)

Links an TeeBlock to the end of the current IPipelineBuilder.

public static IPipelineBuilder<TFirst, ISourceBlock<O>> Tee<TFirst, I, T, O>(this IPipelineBuilder<TFirst, ISourceBlock<I>> p, IPropagatorBlock<I, T> inner, Func<I, T, O> combinator, DataflowBlockOptions? options = null) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<I>>
inner IPropagatorBlock<I, T>
combinator Func<I, T, O>
options DataflowBlockOptions

Returns

IPipelineBuilder<TFirst, ISourceBlock<O>>

Type Parameters

TFirst
I
T
O

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

WithNotification<TFirst, T>(IPipelineBuilder<TFirst, ISourceBlock<T>>, ConfigureHooks<T>)

Wraps the last block of the current IPipelineBuilder in a SourceBlockWithDeliveryNotification.

public static IPipelineBuilder<TFirst, NotifyingSourceBlock<T>> WithNotification<TFirst, T>(this IPipelineBuilder<TFirst, ISourceBlock<T>> p, ConfigureHooks<T> hooks) where TFirst : IDataflowBlock

Parameters

p IPipelineBuilder<TFirst, ISourceBlock<T>>
hooks ConfigureHooks<T>

Returns

IPipelineBuilder<TFirst, NotifyingSourceBlock<T>>

Type Parameters

TFirst
T