Pipes reads on SC::AsyncReadableStream to SC::AsyncWritableStream. More...
#include <AsyncStreams.h>
Public Member Functions | |
Result | pipe (AsyncReadableStream &asyncSource, Span< AsyncWritableStream * > asyncSinks) |
Reports errors by source, transforms or sinks. More... | |
Result | pipe (AsyncReadableStream &asyncSource, Span< AsyncTransformStream * > asyncTransforms, Span< AsyncWritableStream * > asyncSinks) |
Inits the pipeline with a source, transforms and some writable sinks. More... | |
Result | start () |
Starts the pipeline. More... | |
Public Attributes | |
Event< MaxListeners, Result > | eventError |
Static Public Attributes | |
static constexpr int | MaxListeners = 8 |
Pipes reads on SC::AsyncReadableStream to SC::AsyncWritableStream.
Back-pressure happens when the source provides data at a faster rate than what the sink (writable) is able to process. When this happens, AsyncPipeline will AsyncReadableStream::pause the (source). It will also AsyncReadableStream::resume it when some writable has finished writing, freeing one buffer. Caller needs to set AsyncPipeline::source field and AsyncPipeline::sinks with valid streams.
Result SC::AsyncPipeline::pipe | ( | AsyncReadableStream & | asyncSource, |
Span< AsyncTransformStream * > | asyncTransforms, | ||
Span< AsyncWritableStream * > | asyncSinks | ||
) |
Inits the pipeline with a source, transforms and some writable sinks.
Result SC::AsyncPipeline::pipe | ( | AsyncReadableStream & | asyncSource, |
Span< AsyncWritableStream * > | asyncSinks | ||
) |
Reports errors by source, transforms or sinks.
Inits the pipeline with a source and some writable sinks
Result SC::AsyncPipeline::start | ( | ) |
Starts the pipeline.