MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::Event Class Reference

Type to represent an event entry from an EventQueue. More...

#include <Event.hpp>

Classes

class  Connected
 A type that wraps a "FI_CONNECTED" event type. More...
class  ConnectionRequested
 A type that wraps a "FI_CONNREQ" event type. More...
class  Error
 A type that wraps an error received from the event queue. More...
class  Shutdown
 A type that wraps a "FI_SHUTDOWN" event type. More...

Public Types

using Inner = std::variant<ConnectionRequested, Connected, Shutdown, Error>

Public Member Functions

Connected const & connected () const
 Get a connected representation of the event. Throws if the event is not a connected event. Users should previously check if the event is a connected event, see isConnected().
ConnectionRequested const & connReq () const
 Get a connection request representation of the event. Throws if the event is not a connection request. Users should previously check if the event is a connection request, see isConnReq().
Error const & error () const
 Get an error representation of the event. Throws if the event is an error. Users should previously check if the event is an error, see isError().
fid_t fid () noexcept
 fabric descriptor associated with the event
bool isConnected () const noexcept
 Returns true if this event is a FI_CONNECTED.
bool isConnReq () const noexcept
 returns true if this event is a FI_CONNREQ
bool isError () const noexcept
 Returns true if this event is an error entry.
bool isShutdown () const noexcept
 returns true if this event is a FI_SHUTDOWN
Shutdown const & shutdown () const
 Get a shutdown representation of the event. Throws if the event is not a shutdown event. Users should previously check if the event is a shutdown event, see isShutdown().

Static Public Member Functions

static Event fromError (std::shared_ptr< EventQueue > queue, ::fi_eq_err_entry const *raw)
 create an Event from a libfabric event 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)

Private Member Functions

 Event (Inner)

Private Attributes

Inner _event

Detailed Description

Type to represent an event entry from an EventQueue.

Definition at line 20 of file Event.hpp.

Member Typedef Documentation

◆ Inner

Definition at line 112 of file Event.hpp.

Constructor & Destructor Documentation

◆ Event()

mxl::lib::fabrics::ofi::Event::Event ( Inner ev)
private

Definition at line 82 of file Event.cpp.

83 : _event(std::move(ev))
84 {}

Member Function Documentation

◆ connected()

Event::Connected const & mxl::lib::fabrics::ofi::Event::connected ( ) const
nodiscard

Get a connected representation of the event. Throws if the event is not a connected event. Users should previously check if the event is a connected event, see isConnected().

Definition at line 134 of file Event.cpp.

135 {
136 return std::get<Event::Connected>(_event);
137 }

◆ connReq()

Event::ConnectionRequested const & mxl::lib::fabrics::ofi::Event::connReq ( ) const
nodiscard

Get a connection request representation of the event. Throws if the event is not a connection request. Users should previously check if the event is a connection request, see isConnReq().

Definition at line 124 of file Event.cpp.

125 {
126 return std::get<Event::ConnectionRequested>(_event);
127 }

◆ error()

Event::Error const & mxl::lib::fabrics::ofi::Event::error ( ) const
nodiscard

Get an error representation of the event. Throws if the event is an error. Users should previously check if the event is an error, see isError().

Definition at line 154 of file Event.cpp.

155 {
156 return std::get<Event::Error>(_event);
157 }

◆ fid()

fid_t mxl::lib::fabrics::ofi::Event::fid ( )
nodiscardnoexcept

fabric descriptor associated with the event

Definition at line 159 of file Event.cpp.

160 {
161 return std::visit(
162 overloaded{
163 [](ConnectionRequested& ev) { return ev.fid(); },
164 [](Connected& ev) { return ev.fid(); },
165 [](Shutdown& ev) { return ev.fid(); },
166 [](Error& err) { return err.fid(); },
167 },
168 _event);
169 }
A type that wraps a "FI_CONNECTED" event type.
Definition Event.hpp:48
A type that wraps a "FI_CONNREQ" event type.
Definition Event.hpp:26
A type that wraps an error received from the event queue.
Definition Event.hpp:80
A type that wraps a "FI_SHUTDOWN" event type.
Definition Event.hpp:64

◆ fromError()

Event mxl::lib::fabrics::ofi::Event::fromError ( std::shared_ptr< EventQueue > queue,
::fi_eq_err_entry const * raw )
static

create an Event from a libfabric event error entry

Definition at line 104 of file Event.cpp.

105 {
106 auto errDataBuffer = reinterpret_cast<std::uint8_t*>(raw->err_data);
107
108 return {
109 Error{
110 std::move(queue),
111 raw->fid,
112 raw->err,
113 raw->prov_errno,
114 std::vector<uint8_t>(errDataBuffer, errDataBuffer + raw->err_data_size),
115 },
116 };
117 }
::fi_info * raw() noexcept
Returns the raw fi_info object managed by this FabricInfo instance.

◆ fromRawCMEntry()

Event mxl::lib::fabrics::ofi::Event::fromRawCMEntry ( ::fi_eq_cm_entry const & raw,
std::uint32_t eventType )
static

create an Event from a libfabric Connection Management event

Definition at line 91 of file Event.cpp.

92 {
93 // clang-format off
94 switch (eventType)
95 {
96 case FI_CONNREQ: return {ConnectionRequested{entry.fid, FabricInfo::own(entry.info)}};
97 case FI_CONNECTED: return {Connected{entry.fid}};
98 case FI_SHUTDOWN: return {Shutdown{entry.fid}};
99 default: throw Exception::internal("Unsupported event type returned from queue");
100 }
101 // clang-format on
102 }
static Exception internal(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INTERNAL exception.
Definition Exception.hpp:51

◆ fromRawEntry()

Event mxl::lib::fabrics::ofi::Event::fromRawEntry ( ::fi_eq_entry const & raw,
std::uint32_t eventType )
static

Definition at line 86 of file Event.cpp.

87 {
88 throw Exception::internal("unimplemented");
89 }

◆ isConnected()

bool mxl::lib::fabrics::ofi::Event::isConnected ( ) const
nodiscardnoexcept

Returns true if this event is a FI_CONNECTED.

Definition at line 129 of file Event.cpp.

130 {
131 return std::holds_alternative<Connected>(_event);
132 }

◆ isConnReq()

bool mxl::lib::fabrics::ofi::Event::isConnReq ( ) const
nodiscardnoexcept

returns true if this event is a FI_CONNREQ

Definition at line 119 of file Event.cpp.

120 {
121 return std::holds_alternative<ConnectionRequested>(_event);
122 }

◆ isError()

bool mxl::lib::fabrics::ofi::Event::isError ( ) const
nodiscardnoexcept

Returns true if this event is an error entry.

Definition at line 149 of file Event.cpp.

150 {
151 return std::holds_alternative<Error>(_event);
152 }

◆ isShutdown()

bool mxl::lib::fabrics::ofi::Event::isShutdown ( ) const
nodiscardnoexcept

returns true if this event is a FI_SHUTDOWN

Definition at line 139 of file Event.cpp.

140 {
141 return std::holds_alternative<Shutdown>(_event);
142 }

◆ shutdown()

Event::Shutdown const & mxl::lib::fabrics::ofi::Event::shutdown ( ) const
nodiscard

Get a shutdown representation of the event. Throws if the event is not a shutdown event. Users should previously check if the event is a shutdown event, see isShutdown().

Definition at line 144 of file Event.cpp.

145 {
146 return std::get<Event::Shutdown>(_event);
147 }

Member Data Documentation

◆ _event

Inner mxl::lib::fabrics::ofi::Event::_event
private

Definition at line 178 of file Event.hpp.


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