Provided buffer queue.
More...
#include <provided_buffers.hpp>
|
| | ProvidedBufferQueue (uint32_t capacity, unsigned int flags=0) |
| | Construct a new ProvidedBufferQueue object.
|
|
size_t | size () const |
| | Get the current size of the buffer queue.
|
|
size_t | capacity () const |
| | Get the capacity of the buffer queue.
|
| template<typename Buffer> |
| uint16_t | push (Buffer &&buffer) |
| | Push a buffer into the provided buffer queue.
|
Provided buffer queue.
A provided buffer queue manages a queue of buffers that can be used in asynchronous operations. User is responsible for pushing buffers into the queue.
- Returns
- std::pair<int, BufferInfo> When pass to async operations, the return type will be a pair of the operation result and the BufferInfo.
◆ ProvidedBufferQueue()
| condy::ProvidedBufferQueue::ProvidedBufferQueue |
( |
uint32_t | capacity, |
|
|
unsigned int | flags = 0 ) |
|
inline |
Construct a new ProvidedBufferQueue object.
- Parameters
-
| capacity | Number of buffers the queue can hold. |
| flags | Optional flags for io_uring buffer ring registration (default: 0). |
◆ push()
template<typename Buffer>
| uint16_t condy::BundledProvidedBufferQueue::push |
( |
Buffer && | buffer | ) |
|
|
inlineinherited |
Push a buffer into the provided buffer queue.
- Template Parameters
-
- Parameters
-
| buffer | The buffer to be pushed |
- Returns
- uint16_t The buffer ID assigned to the pushed buffer.
- Exceptions
-
| std::logic_error | if the capacity of the queue is exceeded |
- Note
- The returned buffer ID is always sequentially ordered, starting from 0 and incrementing by 1 for each buffer pushed into the queue, wrapping around when reaching the queue's capacity.
The documentation for this class was generated from the following file: