Table of Contents

Method OnCompleted

Namespace
SodaFlow.Async
Assembly
SodaFlow.Core.Async.dll

OnCompleted(TState, AsyncQueuedItem<TInput>, AsyncCompletion, IReadOnlyList<AsyncTrackedItem<TInput>>)

Gives two answers for one item whose operation returned or threw: if the pipeline publishes that outcome, and which tracked items start. For example, the next Queued item can start because of that end. The engine always calls this in a SodaFlow transaction, as it calls Admit(TState, AsyncQueuedItem<TInput>, IReadOnlyList<AsyncTrackedItem<TInput>>). Each AsyncMapBase.AsyncToStart<TInput> from this method must contain an AsyncMapBase.AsyncQueuedItem<TInput> from a previous Admit(TState, AsyncQueuedItem<TInput>, IReadOnlyList<AsyncTrackedItem<TInput>>) call. There is no path for a value with no admission.

One item, and never two. A stream carries one value for each transaction, and the edit of the queue for this end is in the transaction that sends its result. Thus, one such end is the most that a transaction can hold. A cancellation is the one end that comes in a group, and it goes to OnCanceled(TState, IReadOnlyList<AsyncQueuedItem<TInput>>, IReadOnlyList<AsyncTrackedItem<TInput>>).

protected abstract AsyncMapBase.AsyncStrategyResult<TInput> OnCompleted(TState state, AsyncMapBase.AsyncQueuedItem<TInput> item, AsyncMapBase.AsyncCompletion completion, IReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>> tracked)

Parameters

state TState

The scheduling state of this MapAsync call.

item AsyncMapBase.AsyncQueuedItem<TInput>

The item that ended. It is the instance that this strategy got for that value in Admit(TState, AsyncQueuedItem<TInput>, IReadOnlyList<AsyncTrackedItem<TInput>>). It is the same instance, thus ReferenceEquals against an item in state tells you if that item is the current run.

completion AsyncMapBase.AsyncCompletion

How the operation ended: it returned, or it threw. A cancellation is not one of these ends. See OnCanceled(TState, IReadOnlyList<AsyncQueuedItem<TInput>>, IReadOnlyList<AsyncTrackedItem<TInput>>).

tracked IReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>>

Each item that the pipeline tracks, Queued or Running, in the sequence of their admissions. It holds no item: the pipeline removes that item before this call. Thus, a strategy can select the first Queued item with no test against it. It holds each other item that the pipeline tracks at this moment, with the status that item has now, and an earlier edit of this same transaction is in it. An item that this decision starts is Queued in it, and not Running. This list does not change while this method runs.

Returns

AsyncMapBase.AsyncStrategyResult<TInput>