Go to the documentation of this file.
19 #ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
20 #define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
29 #include "absl/log/absl_check.h"
37 class InterceptorBatchMethodsImpl;
40 namespace experimental {
59 extern experimental::ClientInterceptorFactoryInterface*
62 extern experimental::ClientInterceptorFactoryInterface*
70 namespace experimental {
93 const char*
method()
const {
return method_; }
112 "violated expectation about Type enum");
116 "violated expectation about Type enum");
120 "violated expectation about Type enum");
124 "violated expectation about Type enum");
141 ClientRpcInfo& operator=(ClientRpcInfo&&) =
default;
146 ABSL_CHECK_LT(pos, interceptors_.size());
147 interceptors_[pos]->Intercept(interceptor_methods);
150 void RegisterInterceptors(
151 const std::vector<std::unique_ptr<
152 experimental::ClientInterceptorFactoryInterface>>& creators,
153 size_t interceptor_pos) {
156 size_t num_interceptors =
160 if (interceptor_pos > num_interceptors) {
165 interceptors_.push_back(std::unique_ptr<experimental::Interceptor>(
167 ->CreateClientInterceptor(
this)));
172 for (
auto it = creators.begin() + interceptor_pos; it != creators.end();
174 auto* interceptor = (*it)->CreateClientInterceptor(
this);
175 if (interceptor !=
nullptr) {
176 interceptors_.push_back(
177 std::unique_ptr<experimental::Interceptor>(interceptor));
181 interceptors_.push_back(std::unique_ptr<experimental::Interceptor>(
183 ->CreateClientInterceptor(
this)));
190 const char* method_ =
nullptr;
191 const char* suffix_for_stats_ =
nullptr;
193 std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_;
194 bool hijacked_ =
false;
195 size_t hijacked_interceptor_ = 0;
217 #endif // GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
Type type() const
Return the type of the RPC (unary or a streaming flavor)
Definition: client_interceptor.h:107
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
experimental::ClientInterceptorFactoryInterface * g_global_client_stats_interceptor_factory
const char * method() const
Return the fully-specified method name.
Definition: client_interceptor.h:93
Type
Type categorizes RPCs by unary or streaming type.
Definition: client_interceptor.h:76
@ CLIENT_STREAMING
Definition: rpc_method.h:33
const char * suffix_for_stats() const
Return an identifying suffix for the client stub, or nullptr if one wasn't specified.
Definition: client_interceptor.h:97
Definition: client_interceptor.h:71
experimental::ClientInterceptorFactoryInterface * g_global_client_interceptor_factory
@ BIDI_STREAMING
Definition: rpc_method.h:35
virtual ~ClientInterceptorFactoryInterface()
Definition: client_interceptor.h:50
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:203
void RegisterGlobalClientInterceptorFactory(ClientInterceptorFactoryInterface *factory)
~ClientRpcInfo()
Definition: client_interceptor.h:84
grpc::ClientContext * client_context()
Return a pointer to the underlying ClientContext structure associated with the RPC to support feature...
Definition: client_interceptor.h:104
Codegen interface for grpc::Channel.
Definition: channel_interface.h:79
ChannelInterface * channel()
Return a pointer to the channel on which the RPC is being sent.
Definition: client_interceptor.h:100
@ SERVER_STREAMING
Definition: rpc_method.h:34
virtual Interceptor * CreateClientInterceptor(ClientRpcInfo *info)=0
RpcType
Definition: rpc_method.h:31
@ NORMAL_RPC
Definition: rpc_method.h:32
Interface for an interceptor.
Definition: interceptor.h:218
Definition: client_interceptor.h:48
Class that is passed as an argument to the Intercept method of the application's Interceptor interfac...
Definition: interceptor.h:95
Definition: interceptor_common.h:37
void TestOnlyResetGlobalClientInterceptorFactory()