7#include <rdma/fabric.h>
48 Event::Error::Error(std::shared_ptr<EventQueue> eq, ::fid_t
fid,
int err,
int providerErr, std::vector<std::uint8_t> errData)
77 auto const* fiStr = ::fi_strerror(
_err);
79 return fmt::format(
"fi_err={} ({}) prov_err={} ({})",
_err, fiStr ? fiStr :
"",
_providerErr, provStr ? provStr :
"");
97 case FI_CONNECTED:
return {
Connected{entry.fid}};
98 case FI_SHUTDOWN:
return {
Shutdown{entry.fid}};
106 auto errDataBuffer =
reinterpret_cast<std::uint8_t*
>(
raw->err_data);
114 std::vector<uint8_t>(errDataBuffer, errDataBuffer +
raw->err_data_size),
121 return std::holds_alternative<ConnectionRequested>(
_event);
126 return std::get<Event::ConnectionRequested>(
_event);
131 return std::holds_alternative<Connected>(
_event);
136 return std::get<Event::Connected>(
_event);
141 return std::holds_alternative<Shutdown>(
_event);
146 return std::get<Event::Shutdown>(
_event);
151 return std::holds_alternative<Error>(
_event);
156 return std::get<Event::Error>(
_event);
165 [](
Shutdown& ev) {
return ev.fid(); },
166 [](
Error& err) {
return err.fid(); },
A type that wraps a "FI_CONNECTED" event type.
::fid_t fid() const noexcept
fabric descriptor associated with the event
A type that wraps a "FI_CONNREQ" event type.
FabricInfoView info() const noexcept
libfabric info struct of the endpoint that requested connection
::fid_t fid() const noexcept
fabric descriptor associated with the event
ConnectionRequested(::fid_t fid, FabricInfo info)
A type that wraps an error received from the event queue.
int providerCode() const noexcept
return the provider-specific error code.
Error(std::shared_ptr< EventQueue > eq, ::fid_t fid, int err, int providerErr, std::vector< std::uint8_t > errData)
::fid_t fid() const noexcept
fabric descriptor associated with the event
int code() const noexcept
return the libfabric error code.
std::shared_ptr< EventQueue > _eq
std::string toString() const
Convert the error to a human-readable string.
std::vector< std::uint8_t > _errData
A type that wraps a "FI_SHUTDOWN" event type.
::fid_t fid() const noexcept
fabric descriptor associated with the event
fid_t fid() noexcept
fabric descriptor associated with the event
bool isConnected() const noexcept
Returns true if this event is a FI_CONNECTED.
std::variant< ConnectionRequested, Connected, Shutdown, Error > Inner
Connected const & connected() const
Get a connected representation of the event. Throws if the event is not a connected event....
bool isError() const noexcept
Returns true if this event is an error entry.
static Event fromRawCMEntry(::fi_eq_cm_entry const &raw, std::uint32_t eventType)
create an Event from a libfabric Connection Management event
static Event fromRawEntry(::fi_eq_entry const &raw, std::uint32_t eventType)
bool isShutdown() const noexcept
returns true if this event is a FI_SHUTDOWN
Error const & error() const
Get an error representation of the event. Throws if the event is an error. Users should previously ch...
static Event fromError(std::shared_ptr< EventQueue > queue, ::fi_eq_err_entry const *raw)
create an Event from a libfabric event error entry
ConnectionRequested const & connReq() const
Get a connection request representation of the event. Throws if the event is not a connection request...
Shutdown const & shutdown() const
Get a shutdown representation of the event. Throws if the event is not a shutdown event....
bool isConnReq() const noexcept
returns true if this event is a FI_CONNREQ
static Exception internal(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INTERNAL exception.
Non-owning view of a FabricInfo. Returned when iterating over a FabricInfoList.
FabricInfo(FabricInfoView) noexcept
Create an owning FabricInfo object from a non-owning view.
::fi_info * raw() noexcept
Returns the raw fi_info object managed by this FabricInfo instance.