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 CQs in the BackendLibfabric module. It provides methods to handle send and receive CQ 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<SendEndpointConcept EndpointType>
std::vector<std::uint64_t> on_send_cq_event(EndpointType &endpoint) const Handles a completion queue event for a send CQ.
This method is called when a completion queue event is received for a send CQ. 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 types (buffered and zero copy).
- Template Parameters:
EndpointType – The type of the send endpoint (either SendEndpointBuffered or SendEndpointZeroCopy)
- Parameters:
endpoint – The send endpoint object
- Returns:
A vector of the keys of the completed send operations
-
void on_recv_cq_event(ReceiveEndpoint &endpoint) const
Handles a completion queue event for a receive CQ.
This method is called when a completion queue event is received for a receive CQ. 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:
endpoint – The receive endpoint object
-
CqReactor(fid_fabric *fabric, OnDataCb on_data_cb)