Go to the documentation of this file.
19 #ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
20 #define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
25 #include "absl/log/absl_check.h"
38 class InterceptorBatchMethodsImpl;
41 namespace experimental {
60 extern experimental::ClientInterceptorFactoryInterface*
63 extern experimental::ClientInterceptorFactoryInterface*
71 namespace experimental {
94 const char*
method()
const {
return method_; }
113 "violated expectation about Type enum");
116 "violated expectation about Type enum");
119 "violated expectation about Type enum");
122 "violated expectation about Type enum");
139 ClientRpcInfo& operator=(ClientRpcInfo&&) =
default;
144 ABSL_CHECK_LT(pos, interceptors_.size());
145 interceptors_[pos]->Intercept(interceptor_methods);
148 void RegisterInterceptors(
149 const std::vector<std::unique_ptr<
150 experimental::ClientInterceptorFactoryInterface>>& creators,
151 size_t interceptor_pos) {
154 size_t num_interceptors =
158 if (interceptor_pos > num_interceptors) {
163 interceptors_.push_back(std::unique_ptr<experimental::Interceptor>(
165 ->CreateClientInterceptor(
this)));
170 for (
auto it = creators.begin() + interceptor_pos; it != creators.end();
172 auto* interceptor = (*it)->CreateClientInterceptor(
this);
173 if (interceptor !=
nullptr) {
174 interceptors_.push_back(
175 std::unique_ptr<experimental::Interceptor>(interceptor));
179 interceptors_.push_back(std::unique_ptr<experimental::Interceptor>(
181 ->CreateClientInterceptor(
this)));
188 const char* method_ =
nullptr;
189 const char* suffix_for_stats_ =
nullptr;
191 std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_;
192 bool hijacked_ =
false;
193 size_t hijacked_interceptor_ = 0;
215 #endif // GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
Type type() const
Return the type of the RPC (unary or a streaming flavor)
Definition: client_interceptor.h:108
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:94
Type
Type categorizes RPCs by unary or streaming type.
Definition: client_interceptor.h:77
@ 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:98
Definition: client_interceptor.h:72
experimental::ClientInterceptorFactoryInterface * g_global_client_interceptor_factory
@ BIDI_STREAMING
Definition: rpc_method.h:35
virtual ~ClientInterceptorFactoryInterface()
Definition: client_interceptor.h:51
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
void RegisterGlobalClientInterceptorFactory(ClientInterceptorFactoryInterface *factory)
~ClientRpcInfo()
Definition: client_interceptor.h:85
grpc::ClientContext * client_context()
Return a pointer to the underlying ClientContext structure associated with the RPC to support feature...
Definition: client_interceptor.h:105
Codegen interface for grpc::Channel.
Definition: channel_interface.h:71
ChannelInterface * channel()
Return a pointer to the channel on which the RPC is being sent.
Definition: client_interceptor.h:101
@ 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:49
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:38
void TestOnlyResetGlobalClientInterceptorFactory()