19 #ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H 20 #define GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H 34 class InterceptorBatchMethodsImpl;
37 namespace experimental {
61 enum class Type { UNARY, CLIENT_STREAMING, SERVER_STREAMING, BIDI_STREAMING };
74 const char*
method()
const {
return method_; }
84 static_assert(Type::UNARY ==
86 "violated expectation about Type enum");
87 static_assert(Type::CLIENT_STREAMING ==
89 "violated expectation about Type enum");
90 static_assert(Type::SERVER_STREAMING ==
92 "violated expectation about Type enum");
93 static_assert(Type::BIDI_STREAMING ==
95 "violated expectation about Type enum");
99 : ctx_(ctx), method_(method), type_(static_cast<Type>(type)) {
107 interceptors_[pos]->Intercept(interceptor_methods);
110 void RegisterInterceptors(
112 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>&
114 for (
const auto& creator : creators) {
115 auto* interceptor = creator->CreateServerInterceptor(
this);
116 if (interceptor !=
nullptr) {
117 interceptors_.push_back(
118 std::unique_ptr<experimental::Interceptor>(interceptor));
123 void Ref() { ref_++; }
131 const char* method_ =
nullptr;
133 std::atomic_int ref_;
134 std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_;
143 #endif // GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H #define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:141
Definition: rpc_method.h:32
Class that is passed as an argument to the Intercept method of the application's Interceptor interfac...
Definition: interceptor.h:87
Definition: rpc_method.h:34
Type type() const
Return the type of the RPC (unary or a streaming flavor)
Definition: server_interceptor.h:77
RpcType
Definition: rpc_method.h:31
Definition: server_interceptor.h:45
grpc::ServerContext * server_context()
Return a pointer to the underlying ServerContext structure associated with the RPC to support feature...
Definition: server_interceptor.h:81
Type
Type categorizes RPCs by unary or streaming type.
Definition: server_interceptor.h:61
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:58
const char * method() const
Return the fully-specified method name.
Definition: server_interceptor.h:74
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
virtual ~ServerInterceptorFactoryInterface()
Definition: server_interceptor.h:47
Interface for an interceptor.
Definition: interceptor.h:190
Definition: interceptor_common.h:36
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:109
Definition: rpc_method.h:33
Definition: rpc_method.h:35
~ServerRpcInfo()
Definition: server_interceptor.h:63