Table of Contents

Method Admit

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

Admit(TState, AsyncQueuedItem<TInput>, IReadOnlyList<AsyncTrackedItem<TInput>>)

Gives the items to start now for a new admitted value. The pipeline tracks that value with the Queued status. See AsyncMapBase.AsyncQueuedItem<TInput>. The engine always calls this in a SodaFlow transaction. See SodaFlow.Async.AsyncMapExecutionManager<TInput, TResult, TStrategyInput> for the cause that makes a change to state here safe with no explicit lock. Return an AsyncMapBase.AsyncToStart<TInput> with incoming to start it immediately. Without that, the item keeps the Queued status. To start a Queued item after this, keep incoming in state, and not only its Value. That keeps its identity and its cancellation during the wait, and it is the value that OnCompleted(TState, AsyncQueuedItem<TInput>, AsyncCompletion, IReadOnlyList<AsyncTrackedItem<TInput>>) gives back. tracked gives the same items, thus a strategy that reads only the queue of the pipeline can keep no queue of its own.

protected abstract IReadOnlyList<AsyncMapBase.AsyncToStart<TInput>> Admit(TState state, AsyncMapBase.AsyncQueuedItem<TInput> incoming, IReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>> tracked)

Parameters

state TState

The scheduling state of this MapAsync call.

incoming AsyncMapBase.AsyncQueuedItem<TInput>

The value that the pipeline admits now.

tracked IReadOnlyList<AsyncMapBase.AsyncTrackedItem<TInput>>

Each item that the pipeline tracks, Queued or Running, in the sequence of their admissions. It does not hold incoming, which the pipeline adds after this call. It holds each other item that the pipeline tracks at this moment, with the status that item has now. An earlier edit of this same transaction is in it. For example, an item that ended in this transaction is gone, and an item that OnCompleted(TState, AsyncQueuedItem<TInput>, AsyncCompletion, IReadOnlyList<AsyncTrackedItem<TInput>>) started in this transaction is Running. This list does not change while this method runs.

Returns

IReadOnlyList<AsyncMapBase.AsyncToStart<TInput>>