class InterceptorBatchMethods

Defined at line 95 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/interceptor.h

Class that is passed as an argument to the

method

of the application's

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

Public Methods

bool QueryInterceptionHookPoint (InterceptionHookPoints type)

Determine whether the current batch has an interception hook point

of type

void Proceed ()

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.

void Hijack ()

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.

ByteBuffer * GetSerializedSendMessage ()

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.

const void * GetSendMessage ()

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.

void ModifySendMessage (const void * message)

Overwrites the message to be sent with

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.

bool GetSendMessageStatus ()

Checks whether the SEND MESSAGE op succeeded. Valid for POST_SEND_MESSAGE

interceptions.

std::multimap<std::string, std::string> * GetSendInitialMetadata ()

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.

Status GetSendStatus ()

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

void ModifySendStatus (const Status & status)

Overwrites the status with

Valid for PRE_SEND_STATUS

interceptions.

std::multimap<std::string, std::string> * GetSendTrailingMetadata ()

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.

void * GetRecvMessage ()

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

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

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

Status * GetRecvStatus ()

Returns a modifiable view of the received status on PRE_RECV_STATUS and

POST_RECV_STATUS interceptions; nullptr if not valid.

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

Returns a modifiable multimap of the received trailing metadata on

PRE_RECV_STATUS and POST_RECV_STATUS interceptions; nullptr if not valid

std::unique_ptr<ChannelInterface> GetInterceptedChannel ()

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.

void FailHijackedRecvMessage ()

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.

void FailHijackedSendMessage ()

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

MESSAGE op

void ~InterceptorBatchMethods ()

Defined at line 97 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/interceptor.h