Class CqReactor
Defined in File CqReactor.hpp
Class Documentation
-
class CqReactor
The CqReactor class contains the callbacks for completion queue events.
The CqReactor class is responsible for handling completion queue events for send and receive sockets in the BackendLibfabric module. It provides methods to handle send and receive socket events and callbacks for send completion and data reception.
Public Functions
-
CqReactor(fid_fabric *fabric, OnDataCb on_data_cb)
Constructs a CqReactor object.
Simply stores passed arguments
- Parameters:
fabric – Pointer to the fid_fabric object representing the fabric
on_data_cb – Callback to be called when data is received
-
template<SendSocketConcept SocketType>
std::vector<std::uint64_t> on_send_socket_cq_event(SocketType &ssocket) const Handles a completion queue event for a send socket.
This method is called when a completion queue event is received for a send socket. It reads up to MAX_CQ_EVENTS events from the CQ. If it receives -FI_EAGAIN, it calls fi_trywait and returns. If it receives -FI_EAVAIL, it reads the error entry and logs the error. If no error occured, it handles all events, returns the send buffer and calls the on_send_completed callback.
The function is identical for both send socket types (buffered and zero copy).
- Template Parameters:
SocketType – The type of the send socket
- Parameters:
ssocket – The send socket object
- Returns:
A vector of the keys of the completed send operations
-
void on_recv_socket_cq_event(ReceiveSocket &rsocket) const
Handles a completion queue event for a receive socket.
This method is called when a completion queue event is received for a receive socket. It reads up to MAX_CQ_EVENTS events from the CQ. If it receives -FI_EAGAIN, it calls fi_trywait and returns. If it receives -FI_EAVAIL, it reads the error entry and logs the error. If no error occured, it gets the data from the CQ, calls the on_data callback and posts a the buffer for reuse.
- Parameters:
rsocket – The receive socket object.
-
CqReactor(fid_fabric *fabric, OnDataCb on_data_cb)