Pipes reads on SC::AsyncReadableStream to SC::AsyncWritableStream. More...
#include <AsyncStreams.h>
Public Member Functions | |
| AsyncPipeline (const AsyncPipeline &)=delete | |
| AsyncPipeline (AsyncPipeline &&)=delete | |
| AsyncPipeline & | operator= (const AsyncPipeline &)=delete |
| AsyncPipeline & | operator= (AsyncPipeline &&)=delete |
| Result | pipe (AsyncReadableStream &asyncSource, Span< AsyncWritableStream * > asyncSinks) |
| Reports errors by source, transforms or sinks. | |
| Result | pipe (AsyncReadableStream &asyncSource, Span< AsyncDuplexStream * > asyncTransforms, Span< AsyncWritableStream * > asyncSinks) |
| Inits the pipeline with a source, transforms and some writable sinks. | |
| bool | unpipe () |
| Unregisters all events from source, transforms ans sinks. | |
| Result | start () |
| Starts the pipeline. | |
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< AsyncDuplexStream * > | 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.
|
nodiscard |
Unregisters all events from source, transforms ans sinks.