Skip to content

Commit

Permalink
mgmtd: step 5: add get-tree txn functionality
Browse files Browse the repository at this point in the history
Adds the guts of the get-tree functionality that is called by or calls
the FE and BE code for get-tree processing.

Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Oct 3, 2023
1 parent db11af5 commit fe37fc8
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 16 deletions.
36 changes: 34 additions & 2 deletions mgmtd/mgmt_be_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,42 @@ static void be_adapter_handle_native_msg(struct mgmt_be_client_adapter *adapter,
struct mgmt_msg_header *msg,
size_t msg_len)
{
struct mgmt_msg_tree_data *tree_msg;
struct mgmt_msg_error *error_msg;

/* get the transaction */

switch (msg->code) {
case MGMT_MSG_CODE_ERROR:
error_msg = (typeof(error_msg))msg;
MGMTD_BE_ADAPTER_DBG("Got ERROR from '%s' txn-id %" PRIx64,
adapter->name, msg->txn_id);

/* Forward the reply to the txn module */
mgmt_txn_notify_error(adapter, msg->txn_id, msg->req_id,
error_msg->error, error_msg->errstr);

break;
case MGMT_MSG_CODE_TREE_DATA:
/* tree data from a backend client */
tree_msg = (typeof(tree_msg))msg;
MGMTD_BE_ADAPTER_DBG("Got TREE_DATA from '%s' txn-id %" PRIx64,
adapter->name, msg->txn_id);

/* Forward the reply to the txn module */
mgmt_txn_notify_tree_data_reply(adapter, msg->txn_id,
msg->req_id,
tree_msg->result_type,
tree_msg->result,
msg_len - sizeof(*tree_msg),
tree_msg->partial_error);
break;
default:
MGMTD_BE_ADAPTER_ERR("unknown native message code %u to BE adapter %s",
msg->code, adapter->name);
MGMTD_BE_ADAPTER_ERR("unknown native message txn-id %" PRIu64
" req-id %" PRIu64
" code %u from BE client for adapter %s",
msg->txn_id, msg->req_id, msg->code,
adapter->name);
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions mgmtd/mgmt_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ DEFINE_MTYPE(MGMTD, MGMTD_TXN_SETCFG_REQ, "txn set-config requests");
DEFINE_MTYPE(MGMTD, MGMTD_TXN_COMMCFG_REQ, "txn commit-config requests");
DEFINE_MTYPE(MGMTD, MGMTD_TXN_GETDATA_REQ, "txn get-data requests");
DEFINE_MTYPE(MGMTD, MGMTD_TXN_GETDATA_REPLY, "txn get-data replies");
DEFINE_MTYPE(MGMTD, MGMTD_TXN_GETTREE_REQ, "txn get-tree requests");
DEFINE_MTYPE(MGMTD, MGMTD_TXN_CFG_BATCH, "txn config batches");
DEFINE_MTYPE(MGMTD, MGMTD_CMT_INFO, "commit info");
1 change: 1 addition & 0 deletions mgmtd/mgmt_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DECLARE_MTYPE(MGMTD_TXN_SETCFG_REQ);
DECLARE_MTYPE(MGMTD_TXN_COMMCFG_REQ);
DECLARE_MTYPE(MGMTD_TXN_GETDATA_REQ);
DECLARE_MTYPE(MGMTD_TXN_GETDATA_REPLY);
DECLARE_MTYPE(MGMTD_TXN_GETTREE_REQ);
DECLARE_MTYPE(MGMTD_TXN_CFG_BATCH);
DECLARE_MTYPE(MGMTD_BE_ADAPTER_MSG_BUF);
DECLARE_MTYPE(MGMTD_CMT_INFO);
Expand Down
Loading

0 comments on commit fe37fc8

Please sign in to comment.