35 static_cast<void>(hdr);
46 if (details ==
nullptr) {
49 "[bug] Unable to calculate wire size for invalid error_response, no payload"};
52 size +=
sizeof(uint32_t);
53 size += details->message.size();
65 if (details ==
nullptr) {
68 "[bug] Unable to calculate wire size for invalid init_storage_request, no payload"};
71 size +=
sizeof(uint32_t);
72 size += details->mmap_export_blob.size();
80 if (details ==
nullptr) {
83 "[bug] Unable to calculate wire size for invalid create_rdma_connection_xxx message, no payload"};
86 size +=
sizeof(uint32_t);
87 size += details->connection_details.size();
100 "Unable to calculate wire size for unhandled message type: " +
121 if (details ==
nullptr) {
123 "[bug] Unable to encode invalid error_response, no payload"};
131 if (details ==
nullptr) {
134 "[bug] Unable to encode invalid query_storage_response, no payload"};
141 if (details ==
nullptr) {
143 "[bug] Unable to encode invalid init_storage_request, no payload"};
153 if (details ==
nullptr) {
156 "[bug] Unable to encode invalid rdma_connection_details_payload, no payload"};
193 auto details = std::make_unique<error_response_payload>();
196 msg.
payload = std::move(details);
199 auto details = std::make_unique<storage_details_payload>();
202 msg.
payload = std::move(details);
205 auto details = std::make_unique<init_storage_payload>();
210 msg.
payload = std::move(details);
214 auto details = std::make_unique<rdma_connection_details_payload>();
219 msg.
payload = std::move(details);
243 return "error_response";
245 return "query_storage_request";
247 return "query_storage_response";
249 return "init_storage_request";
251 return "init_storage_response";
253 return "create_rdma_connection_request";
255 return "create_rdma_connection_response";
257 return "start_storage_request";
259 return "start_storage_response";
261 return "stop_storage_request";
263 return "stop_storage_response";
265 return "shutdown_request";
267 return "shutdown_response";
282 return "UNKNOWN(" +
std::to_string(
static_cast<uint32_t
>(role)) +
")";
289 s +=
"control_message: {";
300 if (details ==
nullptr) {
302 "[bug] Unable to encode invalid error_response, no payload"};
306 s +=
", message: \"";
307 s += details->message;
312 if (details ==
nullptr) {
315 "[bug] Unable to encode invalid query_storage_response, no payload"};
319 s +=
", block_size: ";
324 if (details ==
nullptr) {
326 "[bug] Unable to encode invalid init_storage_request, no payload"};
330 s +=
", batch_size: ";
332 s +=
", core_count: ";
334 s +=
", mmap_export_blob: [";
336 details->mmap_export_blob.size(),
342 if (details ==
nullptr) {
345 "[bug] Unable to encode invalid create_rdma_connection_request, no payload"};
347 s +=
"context_idx: ";
351 s +=
", connection_details: [";
353 details->connection_details.size(),
359 if (details ==
nullptr) {
362 "[bug] Unable to encode invalid create_rdma_connection_response, no payload"};
364 s +=
"context_idx: ";
368 s +=
", connection_details: [";
370 details->connection_details.size(),
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
@ DOCA_ERROR_INVALID_VALUE
uint32_t wire_size(storage::control::message_header const &hdr) noexcept
@ create_rdma_connection_request
@ create_rdma_connection_response
std::string to_string(storage::control::message const &msg)
char * encode(char *buffer, storage::control::message_header const &hdr) noexcept
char const * decode(char const *buffer, storage::control::message_header &hdr) noexcept
std::string to_string(storage::control::message_type type)
std::string bytes_to_hex_str(char const *bytes, size_t byte_count)
char const * from_buffer(char const *buffer, T &value)
char * to_buffer(char *buffer, uint8_t value)
storage::control::correlation_id correlation_id
storage::control::message_id message_id
std::unique_ptr< storage::control::message::payload > payload
storage::control::message_type message_type
storage::control::rdma_connection_role role