EsStreamSinkPromise
Description
A sink where the destination is provided later.
The sink is a normal sink that you can add events to immediately, but until #setDestinationSink: is called, the events will be buffered.
The same effect can be achieved by using an <EsStreamController> and adding it to the sink using sink addStream:
when the destination sink is ready. This class attempts to shortcut some overhead when possible. For example, if the sink only has events added after the destination sink has been set, those events are added directly to the sink.
Instance State
to the sink will be forwarded to the destination. Events can be added to the sink either before or after a destination sink is set
Class Methods
<details> fromFuture:
<pre><code> Convert an <EsFuture> that completes with an <EsStreamSink> to an <EsStreamSink>
This creates a sink using a sink promise, and sets the destination sink
to the result of the future when the future completes.
If the future completes with an error, the returned sink will instead
be closed. Its [sink done] future will contain the error.
Arguments:
sinkFuture - <EsFuture> that completes with an <EsStreamSink>
Answers:
<EsStreamSink>
</code></pre> </details>
<details> new
<pre><code> Answers a new init instance of an <EsStreamSinkPromise>
Answers:
<EsStreamSinkPromise>
</code></pre> </details>
Instance Methods
<details> setDestinationSink:
<pre><code> Sets a sink as the destination for events from the <EsStreamSinkPromise>'s sink.
The promise's sink will act exactly as @destinationSink.
If the destination sink is set before events are added to sink, further
events are forwarded directly to @destinationSink.
If events are added to sink before setting the @destinationSink, they're
buffered until the destination is available.
A @destinationSink may be set at most once.
Either of #setDestinationSink: or #setError: may be called at most once.
Trying to call either of them again will fail.
Arguments:
destinationSink - <EsStreamSink>
</code></pre> </details>
<details> setError:
<pre><code> Completes this to a closed sink whose [sink done] future emits @error
This is useful when the process of loading the sink fails.
Either of #setDestinationSink: or #setError: may be called at most once.
Trying to call either of them again will fail.
Arguments:
error - <Object>
</code></pre> </details>
<details> setError:stackTrace:
<pre><code> Completes this to a closed sink whose [sink done] future emits @error
This is useful when the process of loading the sink fails.
Either of #setDestinationSink: or #setError: may be called at most once.
Trying to call either of them again will fail.
Arguments:
error - <Object>
</code></pre> </details>
<details> sink
<pre><code> The sink for this promise
Answers:
<EsStreamSink>
</code></pre> </details>
Last modified date: 04/21/2022