Skip to content

Commit

Permalink
Add batch_size_hint field to RCResponse message. (#110)
Browse files Browse the repository at this point in the history
Fixes #109
  • Loading branch information
szmyd authored Dec 4, 2024
1 parent 3e0374f commit 03cacff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class NuRaftGrpcConan(ConanFile):
name = "nuraft_grpc"
version = "6.1.3"
version = "6.2.0"
homepage = "https://github.com/eBay/nuraft_mesg"
description = "A gRPC service for NuRAFT"
topics = ("ebay", "nublox", "raft")
Expand Down Expand Up @@ -53,7 +53,7 @@ def requirements(self):
self.requires("sisl/8.6.8")

self.requires("lz4/1.9.4", override=True)
self.requires("grpc/1.50.1", override=True)
self.requires("grpc/1.50.1", override=True)

def build(self):
cmake = CMake(self)
Expand Down
1 change: 1 addition & 0 deletions src/lib/grpc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ inline shared< nuraft::resp_msg > toResponse(RaftMessage const& raft_msg) {
auto const& resp = raft_msg.rc_response();
auto message = std::make_shared< grpc_resp >(base.term(), (nuraft::msg_type)base.type(), base.src(), base.dest(),
resp.next_index(), resp.accepted());
message->set_next_batch_size_hint_in_bytes(resp.batch_size_hint());
message->set_result_code((nuraft::cmd_result_code)(0 - resp.result_code()));
if (nuraft::cmd_result_code::NOT_LEADER == message->get_result_code()) {
LOGINFOMOD(nuraft_mesg, "Leader has changed!");
Expand Down
1 change: 1 addition & 0 deletions src/lib/grpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static RCResponse* fromRCResponse(nuraft::resp_msg& rcmsg) {
auto req = new RCResponse;
req->set_next_index(rcmsg.get_next_idx());
req->set_accepted(rcmsg.get_accepted());
req->set_batch_size_hint(rcmsg.get_next_batch_size_hint_in_bytes());
req->set_result_code((ResultCode)(0 - rcmsg.get_result_code()));
auto ctx = rcmsg.get_ctx();
if (ctx) { req->set_context(ctx->data(), ctx->container_size()); }
Expand Down
1 change: 1 addition & 0 deletions src/proto/raft_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ message RCResponse {
bytes context = 3;
string dest_addr = 4;
ResultCode result_code = 5;
uint64 batch_size_hint = 6;
}

message RaftMessage {
Expand Down

0 comments on commit 03cacff

Please sign in to comment.