GRPC C++  1.62.0
Public Member Functions
grpc::experimental::InterceptorBatchMethods Class Referenceabstract

Class that is passed as an argument to the Intercept method of the application's Interceptor interface implementation. More...

#include <interceptor.h>

Public Member Functions

virtual ~InterceptorBatchMethods ()
 
virtual bool QueryInterceptionHookPoint (InterceptionHookPoints type)=0
 Determine whether the current batch has an interception hook point of type type. More...
 
virtual void Proceed ()=0
 Signal that the interceptor is done intercepting the current batch of the RPC. More...
 
virtual void Hijack ()=0
 Indicate that the interceptor has hijacked the RPC (only valid if the batch contains send_initial_metadata on the client side). More...
 
virtual ByteBufferGetSerializedSendMessage ()=0
 Send Message Methods GetSerializedSendMessage and GetSendMessage/ModifySendMessage are the available methods to view and modify the request payload. More...
 
virtual const void * GetSendMessage ()=0
 Returns a non-modifiable pointer to the non-serialized form of the message to be sent. More...
 
virtual void ModifySendMessage (const void *message)=0
 Overwrites the message to be sent with message. More...
 
virtual bool GetSendMessageStatus ()=0
 Checks whether the SEND MESSAGE op succeeded. More...
 
virtual std::multimap< std::string, std::string > * GetSendInitialMetadata ()=0
 Returns a modifiable multimap of the initial metadata to be sent. More...
 
virtual Status GetSendStatus ()=0
 Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions. More...
 
virtual void ModifySendStatus (const Status &status)=0
 Overwrites the status with status. More...
 
virtual std::multimap< std::string, std::string > * GetSendTrailingMetadata ()=0
 Returns a modifiable multimap of the trailing metadata to be sent. More...
 
virtual void * GetRecvMessage ()=0
 Returns a pointer to the modifiable received message. More...
 
virtual std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata ()=0
 Returns a modifiable multimap of the received initial metadata. More...
 
virtual StatusGetRecvStatus ()=0
 Returns a modifiable view of the received status on PRE_RECV_STATUS and POST_RECV_STATUS interceptions; nullptr if not valid. More...
 
virtual std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvTrailingMetadata ()=0
 Returns a modifiable multimap of the received trailing metadata on PRE_RECV_STATUS and POST_RECV_STATUS interceptions; nullptr if not valid. More...
 
virtual std::unique_ptr< ChannelInterfaceGetInterceptedChannel ()=0
 Gets an intercepted channel. More...
 
virtual void FailHijackedRecvMessage ()=0
 On a hijacked RPC, an interceptor can decide to fail a PRE_RECV_MESSAGE op. More...
 
virtual void FailHijackedSendMessage ()=0
 On a hijacked RPC/ to-be hijacked RPC, this can be called to fail a SEND MESSAGE op. More...
 

Detailed Description

Class that is passed as an argument to the Intercept method of the application's Interceptor interface implementation.

It has five purposes:

  1. Indicate which hook points are present at a specific interception
  2. Allow an interceptor to inform the library that an RPC should continue to the next stage of its processing (which may be another interceptor or the main path of the library)
  3. Allow an interceptor to hijack the processing of the RPC (only for client-side RPCs with PRE_SEND_INITIAL_METADATA) so that it does not proceed with normal processing beyond that stage
  4. Access the relevant fields of an RPC at each interception point
  5. Set some fields of an RPC at each interception point, when possible

Constructor & Destructor Documentation

◆ ~InterceptorBatchMethods()

virtual grpc::experimental::InterceptorBatchMethods::~InterceptorBatchMethods ( )
inlinevirtual

Member Function Documentation

◆ FailHijackedRecvMessage()

virtual void grpc::experimental::InterceptorBatchMethods::FailHijackedRecvMessage ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ FailHijackedSendMessage()

virtual void grpc::experimental::InterceptorBatchMethods::FailHijackedSendMessage ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetInterceptedChannel()

virtual std::unique_ptr<ChannelInterface> grpc::experimental::InterceptorBatchMethods::GetInterceptedChannel ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetRecvInitialMetadata()

virtual std::multimap<grpc::string_ref, grpc::string_ref>* grpc::experimental::InterceptorBatchMethods::GetRecvInitialMetadata ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetRecvMessage()

virtual void* grpc::experimental::InterceptorBatchMethods::GetRecvMessage ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetRecvStatus()

virtual Status* grpc::experimental::InterceptorBatchMethods::GetRecvStatus ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetRecvTrailingMetadata()

virtual std::multimap<grpc::string_ref, grpc::string_ref>* grpc::experimental::InterceptorBatchMethods::GetRecvTrailingMetadata ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSendInitialMetadata()

virtual std::multimap<std::string, std::string>* grpc::experimental::InterceptorBatchMethods::GetSendInitialMetadata ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSendMessage()

virtual const void* grpc::experimental::InterceptorBatchMethods::GetSendMessage ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSendMessageStatus()

virtual bool grpc::experimental::InterceptorBatchMethods::GetSendMessageStatus ( )
pure virtual

Checks whether the SEND MESSAGE op succeeded.

Valid for POST_SEND_MESSAGE interceptions.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSendStatus()

virtual Status grpc::experimental::InterceptorBatchMethods::GetSendStatus ( )
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSendTrailingMetadata()

virtual std::multimap<std::string, std::string>* grpc::experimental::InterceptorBatchMethods::GetSendTrailingMetadata ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ GetSerializedSendMessage()

virtual ByteBuffer* grpc::experimental::InterceptorBatchMethods::GetSerializedSendMessage ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ Hijack()

virtual void grpc::experimental::InterceptorBatchMethods::Hijack ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ ModifySendMessage()

virtual void grpc::experimental::InterceptorBatchMethods::ModifySendMessage ( const void *  message)
pure virtual

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.

Implemented in grpc::internal::InterceptorBatchMethodsImpl, and grpc::internal::CancelInterceptorBatchMethods.

◆ ModifySendStatus()

virtual void grpc::experimental::InterceptorBatchMethods::ModifySendStatus ( const Status status)
pure virtual

Overwrites the status with status.

Valid for PRE_SEND_STATUS interceptions.

Implemented in grpc::internal::InterceptorBatchMethodsImpl, and grpc::internal::CancelInterceptorBatchMethods.

◆ Proceed()

virtual void grpc::experimental::InterceptorBatchMethods::Proceed ( )
pure virtual

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.

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.

◆ QueryInterceptionHookPoint()

virtual bool grpc::experimental::InterceptorBatchMethods::QueryInterceptionHookPoint ( InterceptionHookPoints  type)
pure virtual

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

Implemented in grpc::internal::CancelInterceptorBatchMethods, and grpc::internal::InterceptorBatchMethodsImpl.


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