Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::AsyncPipeline Struct Reference

Pipes reads on SC::AsyncReadableStream to SC::AsyncWritableStream. More...

#include <AsyncStreams.h>

Classes

struct  Sink
 User specified source. More...
 

Public Member Functions

Result start ()
 User specified sinks. More...
 

Public Attributes

Event< MaxListeners, ResulteventError
 
AsyncReadableStreamsource = nullptr
 Emitted when an error occurs. More...
 
Span< Sinksinks
 

Static Public Attributes

static constexpr int MaxListeners = 8
 

Detailed Description

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.

Note
It's crucial to use the same AsyncBuffersPool for the AsyncReadableStream and all AsyncWritableStream

Member Function Documentation

◆ start()

Result SC::AsyncPipeline::start ( )

User specified sinks.

Starts the pipeline

Note
Both source and sinks must have been already setup by the caller

Member Data Documentation

◆ source

AsyncReadableStream* SC::AsyncPipeline::source = nullptr

Emitted when an error occurs.


The documentation for this struct was generated from the following file: