Async source abstraction emitting data events in caller provided byte buffers.
More...
#include <AsyncStreams.h>
|
static constexpr int | MaxListeners = 8 |
|
Async source abstraction emitting data events in caller provided byte buffers.
After AsyncReadableStream::start it will start emitting AsyncReadableStream::eventData with buffers. User must provide a custom async red implementation in AsyncReadableStream::asyncRead. The stream must be paused when the AsyncBuffersPool is full (use AsyncReadableStream::getBufferOrPause). Once the stream is ended, it will emit AsyncReadableStream::eventEnd and it cannot be used further. AsyncReadableStream::eventError will be emitted when an error occurs in any phase.
◆ destroy()
void SC::AsyncReadableStream::destroy |
( |
| ) |
|
Forcefully destroys the readable stream before it's end event releasing all resources.
◆ emitError()
void SC::AsyncReadableStream::emitError |
( |
Result | error | ) |
|
Signals an async error received.
◆ getBufferOrPause()
Returns an unused buffer from pool or pauses the stream if none is available.
◆ getBuffersPool()
◆ init()
Emitted when the underlying resource has been closed.
Inits the readable stream with an AsyncBuffersPool instance that will provide memory for it
- Parameters
-
buffersPool | An instance of AsyncBuffersPool providing read buffers |
requests | User owned memory to hold a circular buffer for read requests |
◆ isEnded()
bool SC::AsyncReadableStream::isEnded |
( |
| ) |
const |
|
inlinenodiscard |
Returns true if the stream is ended (AsyncReadableStream::end has been called)
◆ pause()
void SC::AsyncReadableStream::pause |
( |
| ) |
|
Pauses the readable stream (that can be later resumed)
◆ push()
◆ pushEnd()
void SC::AsyncReadableStream::pushEnd |
( |
| ) |
|
◆ reactivate()
void SC::AsyncReadableStream::reactivate |
( |
bool | doReactivate | ) |
|
◆ resumeReading()
void SC::AsyncReadableStream::resumeReading |
( |
| ) |
|
◆ start()
Result SC::AsyncReadableStream::start |
( |
| ) |
|
Starts the readable stream, that will emit eventData.
◆ asyncRead
Function that every stream must define to implement its custom read operation.
◆ eventClose
Event<MaxListeners> SC::AsyncReadableStream::eventClose |
Emitted when there is no more data.
◆ eventData
Emitted when an error occurs.
◆ eventEnd
Event<MaxListeners> SC::AsyncReadableStream::eventEnd |
Emitted when a new buffer has been read.
The documentation for this struct was generated from the following file: