aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2017-09-19 15:30:11 -0700
committerGravatar Vijay Pai <vpai@google.com>2017-09-21 22:23:44 -0700
commit2046d0b3c50e555f339062b4fba298e8af8b3a1f (patch)
treec63e745b39791a542c75bd03e47837b35b26fbb9 /src
parent87973ea3981af6b73dfc8c08bcb6d3ebf01ce4a0 (diff)
Add unary call mode to GenericStub to allow generic RPC with 1 CQ trip
Diffstat (limited to 'src')
-rw-r--r--src/cpp/client/generic_stub.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc
index de2e449fe8..693b8bea56 100644
--- a/src/cpp/client/generic_stub.cc
+++ b/src/cpp/client/generic_stub.cc
@@ -47,4 +47,14 @@ std::unique_ptr<GenericClientAsyncReaderWriter> GenericStub::PrepareCall(
return CallInternal(channel_.get(), context, method, cq, false, nullptr);
}
+// setup a unary call to a named method
+std::unique_ptr<GenericClientAsyncResponseReader> GenericStub::PrepareUnaryCall(
+ ClientContext* context, const grpc::string& method,
+ const ByteBuffer& request, CompletionQueue* cq) {
+ return std::unique_ptr<GenericClientAsyncResponseReader>(
+ GenericClientAsyncResponseReader::Create(
+ channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::NORMAL_RPC),
+ context, request, false));
+}
+
} // namespace grpc