diff --git a/conanfile.py b/conanfile.py index fa545ef..1ec95eb 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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") @@ -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) diff --git a/src/lib/grpc_client.cpp b/src/lib/grpc_client.cpp index 2ccd334..ddbd3a7 100644 --- a/src/lib/grpc_client.cpp +++ b/src/lib/grpc_client.cpp @@ -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!"); diff --git a/src/lib/grpc_server.cpp b/src/lib/grpc_server.cpp index 465f950..42167a6 100644 --- a/src/lib/grpc_server.cpp +++ b/src/lib/grpc_server.cpp @@ -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()); } diff --git a/src/proto/raft_types.proto b/src/proto/raft_types.proto index b6c6231..7779bb9 100644 --- a/src/proto/raft_types.proto +++ b/src/proto/raft_types.proto @@ -73,6 +73,7 @@ message RCResponse { bytes context = 3; string dest_addr = 4; ResultCode result_code = 5; + uint64 batch_size_hint = 6; } message RaftMessage {