Skip to content

Commit

Permalink
add completion callback as part of the rpc data
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi Akella email = raakella@ebay.com committed Jul 5, 2023
1 parent 126f0c6 commit 020ef60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib/state_machine/replica_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ bool ReplicaSet::register_data_service_apis(std::shared_ptr< nuraft_mesg::consen
SEND_DATA, m_group_id,
[this](sisl::io_blob const& incoming_buf, boost::intrusive_ptr< sisl::GenericRpcData >& rpc_data) {
m_state_machine->on_data_received(incoming_buf, rpc_data);
},
nullptr);
});
!resp) {
// LOG ERROR
return false;
Expand All @@ -60,9 +59,6 @@ bool ReplicaSet::register_data_service_apis(std::shared_ptr< nuraft_mesg::consen
FETCH_DATA, m_group_id,
[this](sisl::io_blob const& incoming_buf, boost::intrusive_ptr< sisl::GenericRpcData >& rpc_data) {
m_state_machine->on_fetch_data_request(incoming_buf, rpc_data);
},
[this](boost::intrusive_ptr< sisl::GenericRpcData >& rpc_data) {
m_state_machine->on_fetch_data_completed(rpc_data);
});
!resp) {
// LOG ERROR
Expand Down
4 changes: 4 additions & 0 deletions src/lib/state_machine/state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ class FetchDataContext : public sisl::GenericRpcContextBase {

void ReplicaStateMachine::on_fetch_data_request(sisl::io_blob const& incoming_buf,
boost::intrusive_ptr< sisl::GenericRpcData >& rpc_data) {
// set the completion callback
rpc_data->set_comp_cb(
[this](boost::intrusive_ptr< sisl::GenericRpcData >& rpc_data) { on_fetch_data_completed(rpc_data); });

// get the pbas for which we need to send the data
data_channel_rpc_hdr common_header;
pba_list_t pbas;
Expand Down

0 comments on commit 020ef60

Please sign in to comment.