From 23579f99bc2da235890388cda292629244165ca1 Mon Sep 17 00:00:00 2001 From: Ravi Nagarjun Akella Date: Fri, 9 Feb 2024 15:31:40 -0700 Subject: [PATCH 1/2] Add send response API that accepts io blob list --- include/sisl/grpc/generic_service.hpp | 1 + src/grpc/generic_service.cpp | 4 ++++ src/grpc/tests/function/echo_async_client.cpp | 15 ++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/sisl/grpc/generic_service.hpp b/include/sisl/grpc/generic_service.hpp index 366bad2e..0ec71647 100644 --- a/include/sisl/grpc/generic_service.hpp +++ b/include/sisl/grpc/generic_service.hpp @@ -60,6 +60,7 @@ class GenericRpcData : public RpcDataAbstract, sisl::ObjLifeCounter< GenericRpcD void enqueue_call_request(::grpc::ServerCompletionQueue& cq) override; void send_response(); + void send_response(io_blob_list_t const& response_blob_list); void set_context(generic_rpc_ctx_ptr ctx); GenericRpcContextBase* get_context(); diff --git a/src/grpc/generic_service.cpp b/src/grpc/generic_service.cpp index 12c61a36..4ae466ea 100644 --- a/src/grpc/generic_service.cpp +++ b/src/grpc/generic_service.cpp @@ -65,6 +65,10 @@ void GenericRpcData::enqueue_call_request(::grpc::ServerCompletionQueue& cq) { } void GenericRpcData::send_response() { m_stream.Write(m_response, static_cast< void* >(m_buf_write_tag.ref())); } +void GenericRpcData::send_response(io_blob_list_t const& response_blob_list) { + serialize_to_byte_buffer(response_blob_list, m_response); + send_response(); +} void GenericRpcData::set_context(generic_rpc_ctx_ptr ctx) { m_rpc_context = std::move(ctx); } diff --git a/src/grpc/tests/function/echo_async_client.cpp b/src/grpc/tests/function/echo_async_client.cpp index 222e8a77..285c8b70 100644 --- a/src/grpc/tests/function/echo_async_client.cpp +++ b/src/grpc/tests/function/echo_async_client.cpp @@ -369,11 +369,11 @@ class TestServer { std::atomic< uint32_t > num_completions = 0ul; template < typename BufT > - static void set_response(BufT const& req, grpc::ByteBuffer& resp) { + static void set_response(BufT const& req, grpc::ByteBuffer& resp, bool set_buf) { DataMessage cli_request; DeserializeFromBuffer(req, cli_request); RELEASE_ASSERT((cli_request.m_buf == GENERIC_CLIENT_MESSAGE), "Could not parse response buffer"); - SerializeToByteBuffer(resp, cli_request); + if (set_buf) { SerializeToByteBuffer(resp, cli_request); } } public: @@ -390,12 +390,17 @@ class TestServer { if ((++num_calls % 2) == 0) { LOGDEBUGMOD(grpc_server, "respond async generic request, call_num {}", num_calls.load()); std::thread([this, rpc = rpc_data] { - set_response(rpc->request_blob(), rpc->response()); - rpc->send_response(); + if ((num_calls % 3) == 0) { + set_response(rpc->request_blob(), rpc->response(), false); + rpc->send_response(io_blob_list_t{rpc->request_blob()}); + } else { + set_response(rpc->request_blob(), rpc->response(), true); + rpc->send_response(); + } }).detach(); return false; } - set_response(rpc_data->request(), rpc_data->response()); + set_response(rpc_data->request(), rpc_data->response(), true); return true; }); RELEASE_ASSERT(res, "register generic rpc failed"); From eba21e2fa7af61e9700f088b39e68b68926d6d10 Mon Sep 17 00:00:00 2001 From: Ravi Nagarjun Akella Date: Fri, 9 Feb 2024 17:53:14 -0700 Subject: [PATCH 2/2] bump conan version --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 98d073be..ddbbecc6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class SISLConan(ConanFile): name = "sisl" - version = "11.1.6" + version = "11.1.7" homepage = "https://github.com/eBay/sisl" description = "Library for fast data structures, utilities"