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 calling end event releasing all resources.
- Note
- It's safe to call destroy in any state and also when already destroyed (it's idempotent)
◆ 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()
◆ getReadQueueSize()
| size_t SC::AsyncReadableStream::getReadQueueSize |
( |
| ) |
const |
|
inlinenodiscard |
Returns the size of read queue.
◆ init()
◆ 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 |
( |
| ) |
|
◆ setReadQueue()
| void SC::AsyncReadableStream::setReadQueue |
( |
Span< Request > | requests | ) |
|
|
inlineconstexpr |
Sets the read queue for this readable stream.
◆ 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: