Table of Contents

Class AsyncConcurrencyStrategy

Namespace
SodaFlow.Async
Assembly
SodaFlow.Async.dll

The entry point, which is not generic, for the strategies in the library: Parallel, Queue, QueuePerGroup, and SwitchLatest. Parallel, Queue, and SwitchLatest use only the schedule and do not read the TInput of the call, thus their input type is Unit. QueuePerGroup reads the input to find its group, thus its input type is the TInput of the call. The schedule of each one is in one shared position, the internal AsyncConcurrencyStrategyFactory in SodaFlow.Core.Async. That factory is generic over the type of a value that a strategy does not use, because Core has no dependency on SodaFlow.Functional and thus no type of its own for it. The static methods below give Unit as that type argument and return the result. Thus, a consumer of this C# wrapper gets a version with the Unit type, which this wrapper also uses for cancelAll and for other values.

As a base class, this class has no relation to that shared factory. This class and AsyncConcurrencyStrategy<TState> are short versions of AsyncConcurrencyStrategy<TInput, TState> in SodaFlow.Core.Async, for a custom strategy that reads no input. Subclass AsyncConcurrencyStrategy<TState> for such a strategy with a state of its own, and this class for such a strategy with no state. The short version gives Unit for each type that the strategy does not use, thus the subclass does not write it.

[PublicAPI]
public abstract class AsyncConcurrencyStrategy : AsyncConcurrencyStrategy<Unit, Unit>
Inheritance
AsyncConcurrencyStrategy
Inherited Members
Extension Methods

Methods

Parallel()

Each send starts its own operation immediately. The results come in the sequence of their ends.

Queue()

One operation or no operation runs at a time. A subsequent send goes to the queue, and the queue runs in sequence.

QueuePerGroup<TInput>()

The entry point for a queue for each group. In one group, one operation or no operation runs at a time, and two different groups run at the same time. Call Create<TGroup>(Func<TInput, TGroup>, IEqualityComparer<TGroup>?) on the result to give the group function. TInput here only lets the compiler infer the input type of that call, and Create<TGroup>(Func<TInput, TGroup>, IEqualityComparer<TGroup>?) makes the strategy.

SwitchLatest()

A new send cancels the operation that runs and replaces it.