13#include <rdma/fi_eq.h>
36 std::optional<std::uint64_t>
data()
const noexcept;
57 explicit Data(::fi_cq_data_entry
const&
raw);
83 explicit Error(::fi_cq_err_entry
const&
raw, std::shared_ptr<CompletionQueue> queue);
87 std::shared_ptr<CompletionQueue>
_cq;
103 return std::bit_cast<void*>(
token);
111 return std::bit_cast<Token>(contextValue);
127 std::optional<Data>
tryData() const noexcept;
132 std::optional<Error>
tryErr() const noexcept;
RAII Wrapper around a libfabric completion queue (fi_cq).
Data variant of the completion entry instance.
bool isLocalWrite() const noexcept
Indicates whether the completion entry represents a local write operation.
friend class CompletionQueue
Completion::Token token() const noexcept
This used to associate a completion entry with an endpoint when multiple endpoints use the same compl...
std::optional< std::uint64_t > data() const noexcept
Accessor for the immediate data associated with the completion entry.
Data(::fi_cq_data_entry const &raw)
bool isRemoteWrite() const noexcept
Indicates whether the completion entry represents a remote write operation.
Error variant of the completion entry instance.
std::string toString() const
Generate a hman-readable string representation of the error entry.
Token token() const noexcept
This used to associate a completion entry with an endpoint when multiple endpoints use the same compl...
friend class CompletionQueue
Error(::fi_cq_err_entry const &raw, std::shared_ptr< CompletionQueue > queue)
std::shared_ptr< CompletionQueue > _cq
Token token() const noexcept
Get the token that was associated with the operation that has completed.
static constexpr Token tokenFromContextValue(void *contextValue) noexcept
Convert between completion tokens and context values that can be written to and read from raw libfabr...
bool isErrEntry() const noexcept
check whether this is an error entry
Data data() const
Accessor for the data variant. Calling this on an error entry will throw.
friend class CompletionQueue
std::variant< Data, Error > Inner
static Token randomToken()
std::uintptr_t Token
A token used to associate a completion entry with an endpoint.
std::optional< Data > tryData() const noexcept
Attempt to access the data variant. Returns std::nullopt if this is an error entry.
std::optional< Error > tryErr() const noexcept
Attempt to access the error variant. Returns std::nullopt if this is a data entry.
bool isDataEntry() const noexcept
Check whether this is a data entry.
static constexpr void * tokenToContextValue(Token token) noexcept
Convert between completion tokens and context values that can be written to and read from raw libfabr...
Error err() const
Accessor for the error variant. Calling this on a data entry will throw.
::fi_info * raw() noexcept
Returns the raw fi_info object managed by this FabricInfo instance.