aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/generic
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 /include/grpc++/generic
parent87973ea3981af6b73dfc8c08bcb6d3ebf01ce4a0 (diff)
Add unary call mode to GenericStub to allow generic RPC with 1 CQ trip
Diffstat (limited to 'include/grpc++/generic')
-rw-r--r--include/grpc++/generic/generic_stub.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index 2b3ff59ea2..d5064318cf 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -20,6 +20,7 @@
#define GRPCXX_GENERIC_GENERIC_STUB_H
#include <grpc++/support/async_stream.h>
+#include <grpc++/support/async_unary_call.h>
#include <grpc++/support/byte_buffer.h>
namespace grpc {
@@ -27,6 +28,7 @@ namespace grpc {
class CompletionQueue;
typedef ClientAsyncReaderWriter<ByteBuffer, ByteBuffer>
GenericClientAsyncReaderWriter;
+typedef ClientAsyncResponseReader<ByteBuffer> GenericClientAsyncResponseReader;
/// Generic stubs provide a type-unsafe interface to call gRPC methods
/// by name.
@@ -51,6 +53,14 @@ class GenericStub final {
std::unique_ptr<GenericClientAsyncReaderWriter> PrepareCall(
ClientContext* context, const grpc::string& method, CompletionQueue* cq);
+ /// Setup a unary call to a named method \a method using \a context, and don't
+ /// start it. Let it be started explicitly with StartCall.
+ /// The return value only indicates whether or not registration of the call
+ /// succeeded (i.e. the call won't proceed if the return value is nullptr).
+ std::unique_ptr<GenericClientAsyncResponseReader> PrepareUnaryCall(
+ ClientContext* context, const grpc::string& method,
+ const ByteBuffer& request, CompletionQueue* cq);
+
private:
std::shared_ptr<ChannelInterface> channel_;
};