Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc::internal::InterceptorBatchMethodsImpl Class Reference

#include <interceptor_common.h>

Inheritance diagram for grpc::internal::InterceptorBatchMethodsImpl:
Inheritance graph
[legend]

Public Member Functions

void AddInterceptionHookPoint (experimental::InterceptionHookPoints type)
 
void ClearState ()
 
void FailHijackedRecvMessage () override
 
void FailHijackedSendMessage () override
 
std::unique_ptr< ChannelInterfaceGetInterceptedChannel () override
 
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata () override
 
void * GetRecvMessage () override
 
StatusGetRecvStatus () override
 
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvTrailingMetadata () override
 
std::multimap< std::string, std::string > * GetSendInitialMetadata () override
 
const void * GetSendMessage () override
 
bool GetSendMessageStatus () override
 
Status GetSendStatus () override
 Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions. More...
 
std::multimap< std::string, std::string > * GetSendTrailingMetadata () override
 
ByteBufferGetSerializedSendMessage () override
 
void Hijack () override
 
 InterceptorBatchMethodsImpl ()
 
bool InterceptorsListEmpty ()
 
void ModifySendMessage (const void *message) override
 
void ModifySendStatus (const Status &status) override
 
void Proceed () override
 
bool QueryInterceptionHookPoint (experimental::InterceptionHookPoints type) override
 
bool RunInterceptors ()
 
bool RunInterceptors (std::function< void(void)> f)
 
void SetCall (Call *call)
 
void SetCallOpSetInterface (CallOpSetInterface *ops)
 
void SetRecvInitialMetadata (MetadataMap *map)
 
void SetRecvMessage (void *message, bool *hijacked_recv_message_failed)
 
void SetRecvStatus (Status *status)
 
void SetRecvTrailingMetadata (MetadataMap *map)
 
void SetReverse ()
 
void SetSendInitialMetadata (std::multimap< std::string, std::string > *metadata)
 
void SetSendMessage (ByteBuffer *buf, const void **msg, bool *fail_send_message, std::function< Status(const void *)> serializer)
 
void SetSendStatus (grpc_status_code *code, std::string *error_details, std::string *error_message)
 
void SetSendTrailingMetadata (std::multimap< std::string, std::string > *metadata)
 
 ~InterceptorBatchMethodsImpl () override
 
- Public Member Functions inherited from grpc::experimental::InterceptorBatchMethods
virtual ~InterceptorBatchMethods ()
 

Private Member Functions

void ClearHookPoints ()
 
void ProceedClient ()
 
void ProceedServer ()
 
void RunClientInterceptors ()
 
void RunServerInterceptors ()
 

Private Attributes

Callcall_ = nullptr
 
std::function< void(void)> callback_
 
grpc_status_codecode_ = nullptr
 
size_t current_interceptor_index_ = 0
 
std::string * error_details_ = nullptr
 
std::string * error_message_ = nullptr
 
boolfail_send_message_ = nullptr
 
boolhijacked_recv_message_failed_ = nullptr
 
std::array< bool, static_cast< size_t > experimental::InterceptionHookPoints::NUM_INTERCEPTION_HOOKS)> hooks_
 
CallOpSetInterfaceops_ = nullptr
 
const void ** orig_send_message_ = nullptr
 
bool ran_hijacking_interceptor_ = false
 
MetadataMaprecv_initial_metadata_ = nullptr
 
void * recv_message_ = nullptr
 
Statusrecv_status_ = nullptr
 
MetadataMaprecv_trailing_metadata_ = nullptr
 
bool reverse_ = false
 
std::multimap< std::string, std::string > * send_initial_metadata_
 
ByteBuffersend_message_ = nullptr
 
std::multimap< std::string, std::string > * send_trailing_metadata_ = nullptr
 
std::function< Status(const void *)> serializer_
 

Detailed Description

Definition at line 37 of file interceptor_common.h.

Constructor & Destructor Documentation

◆ InterceptorBatchMethodsImpl()

grpc::internal::InterceptorBatchMethodsImpl::InterceptorBatchMethodsImpl ( )
inline

Definition at line 40 of file interceptor_common.h.

◆ ~InterceptorBatchMethodsImpl()

grpc::internal::InterceptorBatchMethodsImpl::~InterceptorBatchMethodsImpl ( )
inlineoverride

Definition at line 49 of file interceptor_common.h.

Member Function Documentation

◆ AddInterceptionHookPoint()

void grpc::internal::InterceptorBatchMethodsImpl::AddInterceptionHookPoint ( experimental::InterceptionHookPoints  type)
inline

Definition at line 79 of file interceptor_common.h.

◆ ClearHookPoints()

void grpc::internal::InterceptorBatchMethodsImpl::ClearHookPoints ( )
inlineprivate

Definition at line 364 of file interceptor_common.h.

◆ ClearState()

void grpc::internal::InterceptorBatchMethodsImpl::ClearState ( )
inline

Definition at line 202 of file interceptor_common.h.

◆ FailHijackedRecvMessage()

void grpc::internal::InterceptorBatchMethodsImpl::FailHijackedRecvMessage ( )
inlineoverridevirtual

On a hijacked RPC, an interceptor can decide to fail a PRE_RECV_MESSAGE op. This would be a signal to the reader that there will be no more messages, or the stream has failed or been cancelled.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 195 of file interceptor_common.h.

◆ FailHijackedSendMessage()

void grpc::internal::InterceptorBatchMethodsImpl::FailHijackedSendMessage ( )
inlineoverridevirtual

On a hijacked RPC/ to-be hijacked RPC, this can be called to fail a SEND MESSAGE op

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 132 of file interceptor_common.h.

◆ GetInterceptedChannel()

std::unique_ptr<ChannelInterface> grpc::internal::InterceptorBatchMethodsImpl::GetInterceptedChannel ( )
inlineoverridevirtual

Gets an intercepted channel. When a call is started on this interceptor, only interceptors after the current interceptor are created from the factory objects registered with the channel. This allows calls to be started from interceptors without infinite regress through the interceptor list.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 184 of file interceptor_common.h.

◆ GetRecvInitialMetadata()

std::multimap<grpc::string_ref, grpc::string_ref>* grpc::internal::InterceptorBatchMethodsImpl::GetRecvInitialMetadata ( )
inlineoverridevirtual

Returns a modifiable multimap of the received initial metadata. Valid for PRE_RECV_INITIAL_METADATA and POST_RECV_INITIAL_METADATA interceptions; nullptr if not valid

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 125 of file interceptor_common.h.

◆ GetRecvMessage()

void* grpc::internal::InterceptorBatchMethodsImpl::GetRecvMessage ( )
inlineoverridevirtual

Returns a pointer to the modifiable received message. Note that the message is already deserialized but the type is not set; the interceptor should static_cast to the appropriate type before using it. This is valid for PRE_RECV_MESSAGE and POST_RECV_MESSAGE interceptions; nullptr for not valid

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 123 of file interceptor_common.h.

◆ GetRecvStatus()

Status* grpc::internal::InterceptorBatchMethodsImpl::GetRecvStatus ( )
inlineoverridevirtual

Returns a modifiable view of the received status on PRE_RECV_STATUS and POST_RECV_STATUS interceptions; nullptr if not valid.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 130 of file interceptor_common.h.

◆ GetRecvTrailingMetadata()

std::multimap<grpc::string_ref, grpc::string_ref>* grpc::internal::InterceptorBatchMethodsImpl::GetRecvTrailingMetadata ( )
inlineoverridevirtual

Returns a modifiable multimap of the received trailing metadata on PRE_RECV_STATUS and POST_RECV_STATUS interceptions; nullptr if not valid

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 138 of file interceptor_common.h.

◆ GetSendInitialMetadata()

std::multimap<std::string, std::string>* grpc::internal::InterceptorBatchMethodsImpl::GetSendInitialMetadata ( )
inlineoverridevirtual

Returns a modifiable multimap of the initial metadata to be sent. Valid for PRE_SEND_INITIAL_METADATA interceptions. A value of nullptr indicates that this field is not valid.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 104 of file interceptor_common.h.

◆ GetSendMessage()

const void* grpc::internal::InterceptorBatchMethodsImpl::GetSendMessage ( )
inlineoverridevirtual

Returns a non-modifiable pointer to the non-serialized form of the message to be sent. Valid for PRE_SEND_MESSAGE interceptions. A return value of nullptr indicates that this field is not valid.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 92 of file interceptor_common.h.

◆ GetSendMessageStatus()

bool grpc::internal::InterceptorBatchMethodsImpl::GetSendMessageStatus ( )
inlineoverridevirtual

Checks whether the SEND MESSAGE op succeeded. Valid for POST_SEND_MESSAGE interceptions.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 102 of file interceptor_common.h.

◆ GetSendStatus()

Status grpc::internal::InterceptorBatchMethodsImpl::GetSendStatus ( )
inlineoverridevirtual

Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 108 of file interceptor_common.h.

◆ GetSendTrailingMetadata()

std::multimap<std::string, std::string>* grpc::internal::InterceptorBatchMethodsImpl::GetSendTrailingMetadata ( )
inlineoverridevirtual

Returns a modifiable multimap of the trailing metadata to be sent. Valid for PRE_SEND_STATUS interceptions. A value of nullptr indicates that this field is not valid.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 119 of file interceptor_common.h.

◆ GetSerializedSendMessage()

ByteBuffer* grpc::internal::InterceptorBatchMethodsImpl::GetSerializedSendMessage ( )
inlineoverridevirtual

Send Message Methods GetSerializedSendMessage and GetSendMessage/ModifySendMessage are the available methods to view and modify the request payload. An interceptor can access the payload in either serialized form or non-serialized form but not both at the same time. gRPC performs serialization in a lazy manner, which means that a call to GetSerializedSendMessage will result in a serialization operation if the payload stored is not in the serialized form already; the non-serialized form will be lost and GetSendMessage will no longer return a valid pointer, and this will remain true for later interceptors too. This can change however if ModifySendMessage is used to replace the current payload. Note that ModifySendMessage requires a new payload message in the non-serialized form. This will overwrite the existing payload irrespective of whether it had been serialized earlier. Also note that gRPC Async API requires early serialization of the payload which means that the payload would be available in the serialized form only unless an interceptor replaces the payload with ModifySendMessage. Returns a modifable ByteBuffer holding the serialized form of the message that is going to be sent. Valid for PRE_SEND_MESSAGE interceptions. A return value of nullptr indicates that this ByteBuffer is not valid.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 83 of file interceptor_common.h.

◆ Hijack()

void grpc::internal::InterceptorBatchMethodsImpl::Hijack ( )
inlineoverridevirtual

Indicate that the interceptor has hijacked the RPC (only valid if the batch contains send_initial_metadata on the client side). Later interceptors in the interceptor list will not be called. Later batches on the same RPC will go through interception, but only up to the point of the hijacking interceptor.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 64 of file interceptor_common.h.

◆ InterceptorsListEmpty()

bool grpc::internal::InterceptorBatchMethodsImpl::InterceptorsListEmpty ( )
inline

Definition at line 224 of file interceptor_common.h.

◆ ModifySendMessage()

void grpc::internal::InterceptorBatchMethodsImpl::ModifySendMessage ( const void *  message)
inlineoverridevirtual

Overwrites the message to be sent with message. message should be in the non-serialized form expected by the method. Valid for PRE_SEND_MESSAGE interceptions. Note that the interceptor is responsible for maintaining the life of the message till it is serialized or it receives the POST_SEND_MESSAGE interception point, whichever happens earlier. The modifying interceptor may itself force early serialization by calling GetSerializedSendMessage.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 97 of file interceptor_common.h.

◆ ModifySendStatus()

void grpc::internal::InterceptorBatchMethodsImpl::ModifySendStatus ( const Status status)
inlineoverridevirtual

Overwrites the status with status. Valid for PRE_SEND_STATUS interceptions.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 113 of file interceptor_common.h.

◆ Proceed()

void grpc::internal::InterceptorBatchMethodsImpl::Proceed ( )
inlineoverridevirtual

Signal that the interceptor is done intercepting the current batch of the RPC. Every interceptor must either call Proceed or Hijack on each interception. In most cases, only Proceed will be used. Explicit use of Proceed is what enables interceptors to delay the processing of RPCs while they perform other work. Proceed is a no-op if the batch contains PRE_SEND_CANCEL. Simply returning from the Intercept method does the job of continuing the RPC in this case. This is because PRE_SEND_CANCEL is always in a separate batch and is not allowed to be delayed.

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 56 of file interceptor_common.h.

◆ ProceedClient()

void grpc::internal::InterceptorBatchMethodsImpl::ProceedClient ( )
inlineprivate

Definition at line 301 of file interceptor_common.h.

◆ ProceedServer()

void grpc::internal::InterceptorBatchMethodsImpl::ProceedServer ( )
inlineprivate

Definition at line 341 of file interceptor_common.h.

◆ QueryInterceptionHookPoint()

bool grpc::internal::InterceptorBatchMethodsImpl::QueryInterceptionHookPoint ( experimental::InterceptionHookPoints  type)
inlineoverridevirtual

Determine whether the current batch has an interception hook point of type type

Implements grpc::experimental::InterceptorBatchMethods.

Definition at line 51 of file interceptor_common.h.

◆ RunClientInterceptors()

void grpc::internal::InterceptorBatchMethodsImpl::RunClientInterceptors ( )
inlineprivate

Definition at line 277 of file interceptor_common.h.

◆ RunInterceptors() [1/2]

bool grpc::internal::InterceptorBatchMethodsImpl::RunInterceptors ( )
inline

Definition at line 239 of file interceptor_common.h.

◆ RunInterceptors() [2/2]

bool grpc::internal::InterceptorBatchMethodsImpl::RunInterceptors ( std::function< void(void)>  f)
inline

Definition at line 263 of file interceptor_common.h.

◆ RunServerInterceptors()

void grpc::internal::InterceptorBatchMethodsImpl::RunServerInterceptors ( )
inlineprivate

Definition at line 291 of file interceptor_common.h.

◆ SetCall()

void grpc::internal::InterceptorBatchMethodsImpl::SetCall ( Call call)
inline

Definition at line 216 of file interceptor_common.h.

◆ SetCallOpSetInterface()

void grpc::internal::InterceptorBatchMethodsImpl::SetCallOpSetInterface ( CallOpSetInterface ops)
inline

Definition at line 220 of file interceptor_common.h.

◆ SetRecvInitialMetadata()

void grpc::internal::InterceptorBatchMethodsImpl::SetRecvInitialMetadata ( MetadataMap map)
inline

Definition at line 174 of file interceptor_common.h.

◆ SetRecvMessage()

void grpc::internal::InterceptorBatchMethodsImpl::SetRecvMessage ( void *  message,
bool hijacked_recv_message_failed 
)
inline

Definition at line 169 of file interceptor_common.h.

◆ SetRecvStatus()

void grpc::internal::InterceptorBatchMethodsImpl::SetRecvStatus ( Status status)
inline

Definition at line 178 of file interceptor_common.h.

◆ SetRecvTrailingMetadata()

void grpc::internal::InterceptorBatchMethodsImpl::SetRecvTrailingMetadata ( MetadataMap map)
inline

Definition at line 180 of file interceptor_common.h.

◆ SetReverse()

void grpc::internal::InterceptorBatchMethodsImpl::SetReverse ( )
inline

Definition at line 209 of file interceptor_common.h.

◆ SetSendInitialMetadata()

void grpc::internal::InterceptorBatchMethodsImpl::SetSendInitialMetadata ( std::multimap< std::string, std::string > *  metadata)
inline

Definition at line 152 of file interceptor_common.h.

◆ SetSendMessage()

void grpc::internal::InterceptorBatchMethodsImpl::SetSendMessage ( ByteBuffer buf,
const void **  msg,
bool fail_send_message,
std::function< Status(const void *)>  serializer 
)
inline

Definition at line 143 of file interceptor_common.h.

◆ SetSendStatus()

void grpc::internal::InterceptorBatchMethodsImpl::SetSendStatus ( grpc_status_code code,
std::string *  error_details,
std::string *  error_message 
)
inline

Definition at line 157 of file interceptor_common.h.

◆ SetSendTrailingMetadata()

void grpc::internal::InterceptorBatchMethodsImpl::SetSendTrailingMetadata ( std::multimap< std::string, std::string > *  metadata)
inline

Definition at line 164 of file interceptor_common.h.

Member Data Documentation

◆ call_

Call* grpc::internal::InterceptorBatchMethodsImpl::call_ = nullptr
private

Definition at line 381 of file interceptor_common.h.

◆ callback_

std::function<void(void)> grpc::internal::InterceptorBatchMethodsImpl::callback_
private

Definition at line 384 of file interceptor_common.h.

◆ code_

grpc_status_code* grpc::internal::InterceptorBatchMethodsImpl::code_ = nullptr
private

Definition at line 393 of file interceptor_common.h.

◆ current_interceptor_index_

size_t grpc::internal::InterceptorBatchMethodsImpl::current_interceptor_index_ = 0
private

Definition at line 378 of file interceptor_common.h.

◆ error_details_

std::string* grpc::internal::InterceptorBatchMethodsImpl::error_details_ = nullptr
private

Definition at line 394 of file interceptor_common.h.

◆ error_message_

std::string* grpc::internal::InterceptorBatchMethodsImpl::error_message_ = nullptr
private

Definition at line 395 of file interceptor_common.h.

◆ fail_send_message_

bool* grpc::internal::InterceptorBatchMethodsImpl::fail_send_message_ = nullptr
private

Definition at line 387 of file interceptor_common.h.

◆ hijacked_recv_message_failed_

bool* grpc::internal::InterceptorBatchMethodsImpl::hijacked_recv_message_failed_ = nullptr
private

Definition at line 400 of file interceptor_common.h.

◆ hooks_

std::array<bool, static_cast<size_t> experimental::InterceptionHookPoints::NUM_INTERCEPTION_HOOKS)> grpc::internal::InterceptorBatchMethodsImpl::hooks_
private

Definition at line 376 of file interceptor_common.h.

◆ ops_

CallOpSetInterface* grpc::internal::InterceptorBatchMethodsImpl::ops_ = nullptr
private

Definition at line 383 of file interceptor_common.h.

◆ orig_send_message_

const void** grpc::internal::InterceptorBatchMethodsImpl::orig_send_message_ = nullptr
private

Definition at line 388 of file interceptor_common.h.

◆ ran_hijacking_interceptor_

bool grpc::internal::InterceptorBatchMethodsImpl::ran_hijacking_interceptor_ = false
private

Definition at line 380 of file interceptor_common.h.

◆ recv_initial_metadata_

MetadataMap* grpc::internal::InterceptorBatchMethodsImpl::recv_initial_metadata_ = nullptr
private

Definition at line 402 of file interceptor_common.h.

◆ recv_message_

void* grpc::internal::InterceptorBatchMethodsImpl::recv_message_ = nullptr
private

Definition at line 399 of file interceptor_common.h.

◆ recv_status_

Status* grpc::internal::InterceptorBatchMethodsImpl::recv_status_ = nullptr
private

Definition at line 404 of file interceptor_common.h.

◆ recv_trailing_metadata_

MetadataMap* grpc::internal::InterceptorBatchMethodsImpl::recv_trailing_metadata_ = nullptr
private

Definition at line 406 of file interceptor_common.h.

◆ reverse_

bool grpc::internal::InterceptorBatchMethodsImpl::reverse_ = false
private

Definition at line 379 of file interceptor_common.h.

◆ send_initial_metadata_

std::multimap<std::string, std::string>* grpc::internal::InterceptorBatchMethodsImpl::send_initial_metadata_
private

Definition at line 391 of file interceptor_common.h.

◆ send_message_

ByteBuffer* grpc::internal::InterceptorBatchMethodsImpl::send_message_ = nullptr
private

Definition at line 386 of file interceptor_common.h.

◆ send_trailing_metadata_

std::multimap<std::string, std::string>* grpc::internal::InterceptorBatchMethodsImpl::send_trailing_metadata_ = nullptr
private

Definition at line 397 of file interceptor_common.h.

◆ serializer_

std::function<Status(const void*)> grpc::internal::InterceptorBatchMethodsImpl::serializer_
private

Definition at line 389 of file interceptor_common.h.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:33