diff --git a/src/include/nuraft_mesg/grpc_factory.hpp b/src/include/nuraft_mesg/grpc_factory.hpp index 5e1f837..b709072 100644 --- a/src/include/nuraft_mesg/grpc_factory.hpp +++ b/src/include/nuraft_mesg/grpc_factory.hpp @@ -54,7 +54,7 @@ class grpc_factory : public nuraft::rpc_client_factory, public std::enable_share NullAsyncResult add_server(uint32_t const srv_id, peer_id_t const& srv_addr, nuraft::srv_config const& dest_cfg); // Send a client request to the cluster - NullAsyncResult client_request(std::shared_ptr< nuraft::buffer > buf, nuraft::srv_config const& dest_cfg); + NullAsyncResult append_entry(std::shared_ptr< nuraft::buffer > buf, nuraft::srv_config const& dest_cfg); // Construct and send a RemoveServer message to the cluster NullAsyncResult rem_server(uint32_t const srv_id, nuraft::srv_config const& dest_cfg); diff --git a/src/lib/grpc_factory.cpp b/src/lib/grpc_factory.cpp index fd0eb69..c69015f 100644 --- a/src/lib/grpc_factory.cpp +++ b/src/lib/grpc_factory.cpp @@ -207,8 +207,7 @@ NullAsyncResult grpc_factory::rem_server(uint32_t const srv_id, nuraft::srv_conf return ctx->future(); } -NullAsyncResult grpc_factory::client_request(std::shared_ptr< nuraft::buffer > buf, - nuraft::srv_config const& dest_cfg) { +NullAsyncResult grpc_factory::append_entry(std::shared_ptr< nuraft::buffer > buf, nuraft::srv_config const& dest_cfg) { auto client = create_client(dest_cfg.get_endpoint()); if (!client) { return folly::makeUnexpected(nuraft::CANCELLED); } diff --git a/src/tests/MessagingTest.cpp b/src/tests/MessagingTest.cpp index ff1e8d8..cebd5aa 100644 --- a/src/tests/MessagingTest.cpp +++ b/src/tests/MessagingTest.cpp @@ -226,7 +226,9 @@ TEST_F(MessagingFixture, MemberCrash) { auto buf = nuraft_mesg::create_message(nlohmann::json{ {"op_type", 2}, }); - EXPECT_TRUE(!!app_1_->instance_->append_entries(group_id_, {buf}).get()); + auto factory = std::make_shared< mesg_factory >(custom_factory_, group_id_, "test_type"); + auto const dest_cfg = nuraft::srv_config(to_server_id(app_1_->id_), to_string(app_1_->id_)); + EXPECT_TRUE(!!factory->append_entry(buf, dest_cfg).get()); app_3_ = std::make_shared< TestApplication >("sm3", ports[2]); app_3_->set_id(our_id); diff --git a/test_package/example_client.cpp b/test_package/example_client.cpp index a12ef3e..efc6871 100644 --- a/test_package/example_client.cpp +++ b/test_package/example_client.cpp @@ -53,7 +53,7 @@ int send_message(uint32_t leader_id, nuraft_mesg::group_id_t const& group_id, st auto result = nuraft_mesg::NullResult(folly::makeUnexpected(nuraft::SERVER_IS_JOINING)); while (!result && (nuraft::SERVER_IS_JOINING == result.error() || nuraft::CONFIG_CHANGING == result.error())) { - auto sf = factory->client_request(buf, dest_cfg); + auto sf = factory->append_entry(buf, dest_cfg); std::this_thread::sleep_for(std::chrono::milliseconds(200)); result = std::move(sf).get(); }