Table of Contents

Class AsyncStreamExtensions

Namespace
SodaFlow.Async
Assembly
SodaFlow.Async.dll

Extension methods that connect an impure asynchronous operation to the FRP graph. They listen on a Stream<TInput>, run an async operation for each send, put the result into a StreamSink<TResult>, and give the Queued items and the Running items. They can also connect to streams that cancel Queued work and Running work. The AsyncMapStatus<TInput, TResult> that they return is IDisposable, and a disposal of it stops the full pipeline.

The overloads are different only in the path from the TInput of the call to the input type of the strategy argument. Select the overload for your strategy. A strategy that only schedules, such as Parallel, Queue, or SwitchLatest, does not read the input, thus it needs no converter. A strategy that reads the input, such as QueuePerGroup, needs a TInput that is its input type or a subtype of it. Where that is not true, it needs a converter that changes TInput into its input type. Each other overload is the last overload with a fixed converter. The last overload takes the converter explicitly and needs no relation between the types.

[PublicAPI]
public static class AsyncStreamExtensions
Inheritance
AsyncStreamExtensions
Inherited Members

Methods

MapAsync<TInput, TResult>(Stream<TInput>, StreamSink<TResult>, StreamSink<Exception>, MapAsyncOperation<TInput, TResult>, AsyncConcurrencyStrategyBase<Unit>, Stream<Unit>?, Stream<IReadOnlyCollection<TInput>>?, bool)

For a strategy that uses only the schedule and does not read TInput. Those strategies are Parallel, Queue, and SwitchLatest. This overload changes each input to Unit before the strategy, thus it needs no converter. See the canonical MapAsync<TInput, TResult, TStrategyInput>(Stream<TInput>, StreamSink<TResult>, StreamSink<Exception>, MapAsyncOperation<TInput, TResult>, AsyncConcurrencyStrategyBase<TStrategyInput>, Func<TInput, TStrategyInput>, Stream<Unit>?, Stream<IReadOnlyCollection<TInput>>?, bool) overload for the full parameter contract.

MapAsync<TInput, TResult, TStrategyInput>(Stream<TInput>, StreamSink<TResult>, StreamSink<Exception>, MapAsyncOperation<TInput, TResult>, AsyncConcurrencyStrategyBase<TStrategyInput>, Stream<Unit>?, Stream<IReadOnlyCollection<TInput>>?, bool)

For a strategy that reads the input. Here TInput is the TStrategyInput of the strategy or a subtype of it, thus this overload needs no converter. See the canonical MapAsync<TInput, TResult, TStrategyInput>(Stream<TInput>, StreamSink<TResult>, StreamSink<Exception>, MapAsyncOperation<TInput, TResult>, AsyncConcurrencyStrategyBase<TStrategyInput>, Func<TInput, TStrategyInput>, Stream<Unit>?, Stream<IReadOnlyCollection<TInput>>?, bool) overload for the full parameter contract.

MapAsync<TInput, TResult, TStrategyInput>(Stream<TInput>, StreamSink<TResult>, StreamSink<Exception>, MapAsyncOperation<TInput, TResult>, AsyncConcurrencyStrategyBase<TStrategyInput>, Func<TInput, TStrategyInput>, Stream<Unit>?, Stream<IReadOnlyCollection<TInput>>?, bool)

The fully general shape. Each other MapAsync overload is this overload with a fixed converter. It is the only overload with no necessary relation between TInput and TStrategyInput, because the caller gives inputConverter explicitly. Use a narrower overload where one applies, because those overloads let most calls omit that converter. Use this overload when the input type of strategy has no inheritance relation to the TInput of the call.