13#include <rdma/fi_errno.h>
38 template<QueueReadMode qrm>
43 auto result = std::pair<std::optional<Completion>, std::optional<Event>>{};
64 template<QueueReadMode qrm>
69 auto event = std::optional<Event>{};
90 template<QueueReadMode qrm>
95 auto completion = std::optional<Completion>{};
103 completion = eq.
read();
119 while (
auto event = eq.
read())
121 if (event->isError())
123 auto const& error =
event->error();
125 MXL_WARN(
"Event queue error: {} ({}), provider code {}", ::fi_strerror(error.code()), error.code(), error.providerCode());
131 MXL_WARN(
"Unhandled entry on the event queue: {}", ex.
what());
RAII Wrapper around a libfabric completion queue (fi_cq).
std::optional< Completion > readBlocking(std::chrono::steady_clock::duration timeout)
Perform a blocking read on the completion queue.
std::optional< Completion > read()
Perform a non-blocking read on the completion queue.
RAII Wrapper around a libfabric endpoint (fi_ep).
std::pair< std::optional< Completion >, std::optional< Event > > readQueues()
Do a non-blocking read of both the event and completion queue associated with this endpoint.
std::pair< std::optional< Completion >, std::optional< Event > > readQueuesBlocking(std::chrono::steady_clock::duration timeout)
Do a combined blocking read of both the event and completion queue associated with this endpoint.
RAII Wrapper around a libfabric event queue (fi_eq).
std::optional< Event > readBlocking(std::chrono::steady_clock::duration timeout)
Perform a blocking read on the event queue.
std::optional< Event > read()
Perform a non-blocking read on the event queue. If no event is available in the queue,...
Custom exception type used in the fabrics library.
char const * what() const noexcept override
Implements std::exception, returns a descriptive string about the error.
QueueReadMode
Enum to select blocking or non-blocking queue read behaviour.
void drainEventQueue(EventQueue &eq)
Read all entries from a connectionless endpoint's event queue and log the errors among them.
std::optional< Event > readEventQueue(EventQueue &eq, std::chrono::steady_clock::duration timeout)
Helper to read an event queue with blocking or non-blocking behaviour.
std::pair< std::optional< Completion >, std::optional< Event > > readEndpointQueues(Endpoint &ep, std::chrono::steady_clock::duration timeout)
Helper to read both completion and event queues of an endpoint with blocking or non-blocking behaviou...
std::optional< Completion > readCompletionQueue(CompletionQueue &eq, std::chrono::steady_clock::duration timeout)
Helper to read a completion queue with blocking or non-blocking behaviour.