Skip to content

Template Class TCallData

Template Class TCallData

  • Defined in File CallData.h

Inheritance Relationships

Derived Type

template <class ServiceType, typename RequestType, typename ResponseType>
class TCallData

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h A class that manages the state of a generic RPC call.

DoWork() can be used in child threads to automatically progress the state of the call.

Template Parameters:

  • ServiceType – The type of the service that this CallData is associated with

  • RequestType – The type of the request message for the RPC, this is an incoming message to Unreal

  • ResponseType – The type of the response message for the RPC, this is an outgoing message from Unreal

Subclassed by TExchangeCallData< ServiceType, RequestType, ResponseType >


Public Functions

SymbolDetails
TCallDataConstruct a new CallData object.
CreateCreate/setup the calldata instance.
SubmitSubmit a response to the caller of the TargetRPC.
ResetReset the RPC state object so it can be reused again by another RPC in the future.
FinishThe RPC has been deleted so perform final cleanup.
CleanUpclean up, both this object and any other objects owned by it
GetRequestGet the request associated with this RPC.
GetMutableResponseGet a Response message that can be mutated in place.
SetResponseSet the response message.
HasResponseHas the response message been set already.
IsReadyReturns whether the RPC is ready for processing.
DoWorkProgress the state of the RPC.

TCallData

inline TCallData(ServiceType *Service, ServerCompletionQueue *CQueue,
AsyncAPIHandler TargetRPC, bool bReusable = false,
bool bAutoCreate = true)

Construct a new CallData object.

Parameters

  • Service – [in] The AsyncService that this CallData is associated with

  • CQueue – [in] The completion queue that this CallData will tracked with

  • TargetRPC – [in] The method that this CallData will be servicing

  • bReusable – [in] Whether this CallData should be reused after serving one RPC

  • bAutoCreate – [in] Whether this CallData should automatically create itself, or it should happen later via Create()

#DirectionNameTypeDescription
1ServiceServiceType *The AsyncService that this CallData is associated with
2CQueueServerCompletionQueue *The completion queue that this CallData will tracked with
3TargetRPCAsyncAPIHandlerThe method that this CallData will be servicing
4bReusableboolWhether this CallData should be reused after serving one RPC (default: false)
5bAutoCreateboolWhether this CallData should automatically create itself, or it should happen later via Create() (default: true)

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

Create

inline void Create()

Create/setup the calldata instance.

This registers the calldata as the tag to return when the TargetRPC is called.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

Submit

inline void Submit()

Submit a response to the caller of the TargetRPC.

This will put us back on the queue once the response finished processing.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

Reset

inline void Reset()

Reset the RPC state object so it can be reused again by another RPC in the future.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

Finish

inline void Finish()

The RPC has been deleted so perform final cleanup.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

CleanUp

inline void CleanUp()

clean up, both this object and any other objects owned by it

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

GetRequest

inline const RequestType &GetRequest()

Get the request associated with this RPC.

May be empty if the RPC is not ready

Returns:

A reference to the RPC Request Message from the client

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

GetMutableResponse

inline ResponseType *GetMutableResponse()

Get a Response message that can be mutated in place.

Returns:

A pointer to a response message owned by this object

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

SetResponse

inline void SetResponse(ResponseType *NewResponse)

Set the response message.

Parameters

NewResponse – [in] The new Response message to associate with this call.

#DirectionNameTypeDescription
1NewResponseResponseType *The new Response message to associate with this call.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

HasResponse

inline bool HasResponse()

Has the response message been set already.

Returns:

true iff the response message has been set

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

IsReady

inline bool IsReady()

Returns whether the RPC is ready for processing.

Specifically, does the RPC have a Request?

Returns:

true iff this RPC has a request but has not submitted a response

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h

DoWork

inline void DoWork()

Progress the state of the RPC.

Call this on a child process to handle automatically setting up and completing gRPC calls.

Attributes: inline

Source: Source/Schola/Protobuf/Public/ProtobufBackends/gRPC/CallData.h


Public Members

SymbolDetails
IdThe unique ID of this CallData instance.

Id

int Id = 0

The unique ID of this CallData instance.

Used for debugging,


Protected Types

SymbolDetails
CallStatusAn enum representing the possible states of the RPC.
AsyncAPIHandlerThe signature of the handler for an asynchronous RPC, that is handled by this CallData.

Enum CallStatus

enum CallStatus

An enum representing the possible states of the RPC.

Values:

CREATE

enumerator CREATE
enumerator CREATE

PROCESS

enumerator PROCESS
enumerator PROCESS

FINISH

enumerator FINISH
enumerator FINISH

Type Alias AsyncAPIHandler

using AsyncAPIHandler =
void (ServiceType::*)(grpc::ServerContext *context, RequestType *request,
ServerAsyncResponseWriter<ResponseType> *response,
grpc::CompletionQueue *new_call_cq,
ServerCompletionQueue *notification_cq, void *tag)

The signature of the handler for an asynchronous RPC, that is handled by this CallData.

Protected Attributes

SymbolDetails
SContextThe Context of the Server that this CallData is associated with.
ResponderAn Object that can be used to send a response to the client.
RequestThe incoming request message from the client.
ResponseThe outgoing response message to the client.
TargetRPCA method ptr to the type of Requests this CallData will be servicing.
CallDataStatusThe current state of the RPC.
ServiceThe service that this CallData is associated with.
CQueueThe proiducer-consumer completion queue that this CallData is associated with.
bReusableVariable defining whether we discard this CallData or replace it after serving one RPC.

SContext

ServerContext *SContext

The Context of the Server that this CallData is associated with.


Responder

ServerAsyncResponseWriter<ResponseType> Responder

An Object that can be used to send a response to the client.


Request

RequestType Request

The incoming request message from the client.


Response

ResponseType *Response = nullptr

The outgoing response message to the client.


TargetRPC

AsyncAPIHandler TargetRPC

A method ptr to the type of Requests this CallData will be servicing.


CallDataStatus

CallStatus CallDataStatus

The current state of the RPC.


Service

ServiceType *Service

The service that this CallData is associated with.


CQueue

ServerCompletionQueue *CQueue

The proiducer-consumer completion queue that this CallData is associated with.


bReusable

bool bReusable

Variable defining whether we discard this CallData or replace it after serving one RPC.

Default is to disgard