diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-10-17 12:32:53 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-10-17 12:32:53 -0700 |
commit | af621c7705939dc64af8f5098dbad8d9faace82d (patch) | |
tree | 6aea99aca577c04e9d86dba58329d2b4c6d561e2 /include/grpcpp/server_builder.h | |
parent | b232bacf2792430801e50c716e4f92b6f6f1551a (diff) |
Add method to register server creators
Diffstat (limited to 'include/grpcpp/server_builder.h')
-rw-r--r-- | include/grpcpp/server_builder.h | 28 |
1 files changed, 28 insertions, 0 deletions
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 |