public override async Task Update(FlowBuffer <TInput> inBuf, FlowBuffer <TOutput> outBuf) { TInput[] oldContents = inBuf.Contents.ToArray(); TOutput[] mapped = Map(oldContents); if (ConsumeIf(oldContents, mapped)) { await inBuf.Flow(maxDroplets : inBuf.Capacity).Collect(); mapped = OnInputTransformed(oldContents, mapped); await outBuf.ConsumeFlow(mapped.GetAsyncEnumerator()).Collect(); } else if (inBuf.Full) { switch (InputBufferStrategy) { default: case InputBufferFullStrategy.FlushToOutput: await inBuf.Drip(); await outBuf.ConsumeDroplet(mapped[0]); break; case InputBufferFullStrategy.Empty: while (!inBuf.Empty) { await inBuf.Drip(); } break; case InputBufferFullStrategy.Drip: await inBuf.Drip(); break; } } }
public override async Task Update(FlowBuffer <TInput> inBuf, FlowBuffer <TOutput> outBuf) { await outBuf.ConsumeDroplet(Map(await inBuf.Drip())); }