Condy v1.5.0
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
condy::ProvidedBufferQueue Class Reference

Provided buffer queue. More...

#include <provided_buffers.hpp>

Public Member Functions

 ProvidedBufferQueue (uint32_t capacity, unsigned int flags=0)
 Construct a new ProvidedBufferQueue object in current Runtime.
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.

Detailed Description

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.
Note
The lifetime of this queue must not exceed the running period of the associated Runtime. The buffers pushed into the queue must remain valid until they are consumed from the queue.

Definition at line 187 of file provided_buffers.hpp.

Constructor & Destructor Documentation

◆ ProvidedBufferQueue()

condy::ProvidedBufferQueue::ProvidedBufferQueue ( uint32_t capacity,
unsigned int flags = 0 )
inline

Construct a new ProvidedBufferQueue object in current Runtime.

Parameters
capacityNumber of buffers the queue can hold.
flagsOptional flags for io_uring buffer ring registration (default: 0).

Definition at line 195 of file provided_buffers.hpp.

Member Function Documentation

◆ push()

template<typename Buffer>
uint16_t condy::detail::BundledProvidedBufferQueue::push ( Buffer && buffer)
inlineinherited

Push a buffer into the provided buffer queue.

Template Parameters
BufferType of the buffer
Parameters
bufferThe buffer to be pushed
Returns
uint16_t The buffer ID assigned to the pushed buffer.
Exceptions
std::logic_errorif 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.

Definition at line 117 of file provided_buffers.hpp.


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