Go to the documentation of this file.
19 #ifndef GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
20 #define GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
29 #include "absl/log/absl_check.h"
32 class ServerContextBase;
34 class InterceptorBatchMethodsImpl;
37 namespace experimental {
74 const char*
method()
const {
return method_; }
86 "violated expectation about Type enum");
89 "violated expectation about Type enum");
92 "violated expectation about Type enum");
95 "violated expectation about Type enum");
104 ABSL_CHECK_LT(pos, interceptors_.size());
105 interceptors_[pos]->Intercept(interceptor_methods);
108 void RegisterInterceptors(
110 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>&
112 for (
const auto& creator : creators) {
113 auto* interceptor = creator->CreateServerInterceptor(
this);
114 if (interceptor !=
nullptr) {
115 interceptors_.push_back(
116 std::unique_ptr<experimental::Interceptor>(interceptor));
121 void Ref() { ref_.fetch_add(1, std::memory_order_relaxed); }
123 if (
GPR_UNLIKELY(ref_.fetch_sub(1, std::memory_order_acq_rel) == 1)) {
128 ServerContextBase* ctx_ =
nullptr;
129 const char* method_ =
nullptr;
131 std::atomic<intptr_t> ref_{1};
132 std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_;
141 #endif // GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
const char * method() const
Return the fully-specified method name.
Definition: server_interceptor.h:74
Base class of ServerContext.
Definition: server_context.h:124
~ServerRpcInfo()
Definition: server_interceptor.h:63
@ CLIENT_STREAMING
Definition: rpc_method.h:33
@ BIDI_STREAMING
Definition: rpc_method.h:35
ServerContextBase * server_context()
Return a pointer to the underlying ServerContext structure associated with the RPC to support feature...
Definition: server_interceptor.h:81
ServerRpcInfo & operator=(const ServerRpcInfo &)=delete
@ SERVER_STREAMING
Definition: rpc_method.h:34
ServerRpcInfo(const ServerRpcInfo &)=delete
RpcType
Definition: rpc_method.h:31
@ NORMAL_RPC
Definition: rpc_method.h:32
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:58
Interface for an interceptor.
Definition: interceptor.h:218
Definition: server_interceptor.h:45
virtual Interceptor * CreateServerInterceptor(ServerRpcInfo *info)=0
virtual ~ServerInterceptorFactoryInterface()
Definition: server_interceptor.h:47
Class that is passed as an argument to the Intercept method of the application's Interceptor interfac...
Definition: interceptor.h:95
Type type() const
Return the type of the RPC (unary or a streaming flavor)
Definition: server_interceptor.h:77
Type
Type categorizes RPCs by unary or streaming type.
Definition: server_interceptor.h:61
Definition: interceptor_common.h:37