aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpcpp
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-10-17 12:32:53 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-10-17 12:32:53 -0700
commitaf621c7705939dc64af8f5098dbad8d9faace82d (patch)
tree6aea99aca577c04e9d86dba58329d2b4c6d561e2 /include/grpcpp
parentb232bacf2792430801e50c716e4f92b6f6f1551a (diff)
Add method to register server creators
Diffstat (limited to 'include/grpcpp')
-rw-r--r--include/grpcpp/impl/codegen/call.h14
-rw-r--r--include/grpcpp/server_builder.h28
2 files changed, 34 insertions, 8 deletions
diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h
index 2f5deaae86..0fcfbc8263 100644
--- a/include/grpcpp/impl/codegen/call.h
+++ b/include/grpcpp/impl/codegen/call.h
@@ -764,15 +764,13 @@ class Call final {
: call_hook_(nullptr),
cq_(nullptr),
call_(nullptr),
- max_receive_message_size_(-1),
- client_rpc_info_(nullptr) {}
+ max_receive_message_size_(-1) {}
/** call is owned by the caller */
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
: call_hook_(call_hook),
cq_(cq),
call_(call),
- max_receive_message_size_(-1),
- client_rpc_info_(nullptr) {}
+ max_receive_message_size_(-1) {}
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
experimental::ClientRpcInfo* rpc_info)
@@ -783,12 +781,12 @@ class Call final {
client_rpc_info_(rpc_info) {}
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
- int max_receive_message_size)
+ int max_receive_message_size, experimental::ServerRpcInfo* rpc_info)
: call_hook_(call_hook),
cq_(cq),
call_(call),
max_receive_message_size_(max_receive_message_size),
- client_rpc_info_(nullptr) {}
+ server_rpc_info_(rpc_info) {}
void PerformOps(CallOpSetInterface* ops) {
call_hook_->PerformOpsOnCall(ops, this);
@@ -807,8 +805,8 @@ class Call final {
CompletionQueue* cq_;
grpc_call* call_;
int max_receive_message_size_;
- experimental::ClientRpcInfo* client_rpc_info_;
- experimental::ServerRpcInfo* server_rpc_info_;
+ experimental::ClientRpcInfo* client_rpc_info_ = nullptr;
+ experimental::ServerRpcInfo* server_rpc_info_ = nullptr;
};
/// An abstract collection of call ops, used to generate the
diff --git a/include/grpcpp/server_builder.h b/include/grpcpp/server_builder.h
index a58a59c2d8..4cbcac3532 100644
--- a/include/grpcpp/server_builder.h
+++ b/include/grpcpp/server_builder.h
@@ -28,6 +28,7 @@
#include <grpc/support/cpu.h>
#include <grpc/support/workaround_list.h>
#include <grpcpp/impl/channel_argument_option.h>
+#include <grpcpp/impl/codegen/server_interceptor.h>
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/support/config.h>
@@ -212,6 +213,31 @@ class ServerBuilder {
/// doc/workarounds.md.
ServerBuilder& EnableWorkaround(grpc_workaround_list id);
+ /// NOTE: class experimental_type is not part of the public API of this class.
+ /// TODO(yashykt): Integrate into public API when this is no longer
+ /// experimental.
+ class experimental_type {
+ public:
+ explicit experimental_type(ServerBuilder* builder) : builder_(builder) {}
+
+ void SetInterceptorCreators(
+ std::unique_ptr<std::vector<
+ std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>>
+ interceptor_creators) {
+ if (interceptor_creators != nullptr) {
+ builder_->interceptor_creators_ = std::move(*interceptor_creators);
+ }
+ }
+
+ private:
+ ServerBuilder* builder_;
+ };
+
+ /// NOTE: The function experimental() is not stable public API. It is a view
+ /// to the experimental components of this class. It may be changed or removed
+ /// at any time.
+ experimental_type experimental() { return experimental_type(this); }
+
protected:
/// Experimental, to be deprecated
struct Port {
@@ -297,6 +323,8 @@ class ServerBuilder {
grpc_compression_algorithm algorithm;
} maybe_default_compression_algorithm_;
uint32_t enabled_compression_algorithms_bitset_;
+ std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
+ interceptor_creators_;
};
} // namespace grpc