Template Class TCallData
Template Class TCallData
- Defined in File CallData.h
Inheritance Relationships
Derived Type
public TExchangeCallData< ServiceType, RequestType, ResponseType >(Template Class TExchangeCallData)
template <class ServiceType, typename RequestType, typename ResponseType>class TCallDataSource: 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
| Symbol | Details |
|---|---|
TCallData | Construct a new CallData object. |
Create | Create/setup the calldata instance. |
Submit | Submit a response to the caller of the TargetRPC. |
Reset | Reset the RPC state object so it can be reused again by another RPC in the future. |
Finish | The RPC has been deleted so perform final cleanup. |
CleanUp | clean up, both this object and any other objects owned by it |
GetRequest | Get the request associated with this RPC. |
GetMutableResponse | Get a Response message that can be mutated in place. |
SetResponse | Set the response message. |
HasResponse | Has the response message been set already. |
IsReady | Returns whether the RPC is ready for processing. |
DoWork | Progress 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()
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | Service | ServiceType * | The AsyncService that this CallData is associated with |
| 2 | — | CQueue | ServerCompletionQueue * | The completion queue that this CallData will tracked with |
| 3 | — | TargetRPC | AsyncAPIHandler | The method that this CallData will be servicing |
| 4 | — | bReusable | bool | Whether this CallData should be reused after serving one RPC (default: false) |
| 5 | — | bAutoCreate | bool | Whether 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.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | NewResponse | ResponseType * | 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
| Symbol | Details |
|---|---|
Id | The unique ID of this CallData instance. |
Id
int Id = 0The unique ID of this CallData instance.
Used for debugging,
Protected Types
| Symbol | Details |
|---|---|
CallStatus | An enum representing the possible states of the RPC. |
AsyncAPIHandler | The signature of the handler for an asynchronous RPC, that is handled by this CallData. |
Enum CallStatus
enum CallStatusAn enum representing the possible states of the RPC.
Values:
CREATE
enumerator CREATEenumerator CREATEPROCESS
enumerator PROCESSenumerator PROCESSFINISH
enumerator FINISHenumerator FINISHType 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
| Symbol | Details |
|---|---|
SContext | The Context of the Server that this CallData is associated with. |
Responder | An Object that can be used to send a response to the client. |
Request | The incoming request message from the client. |
Response | The outgoing response message to the client. |
TargetRPC | A method ptr to the type of Requests this CallData will be servicing. |
CallDataStatus | The current state of the RPC. |
Service | The service that this CallData is associated with. |
CQueue | The proiducer-consumer completion queue that this CallData is associated with. |
bReusable | Variable defining whether we discard this CallData or replace it after serving one RPC. |
SContext
ServerContext *SContextThe Context of the Server that this CallData is associated with.
Responder
ServerAsyncResponseWriter<ResponseType> ResponderAn Object that can be used to send a response to the client.
Request
RequestType RequestThe incoming request message from the client.
Response
ResponseType *Response = nullptrThe outgoing response message to the client.
TargetRPC
AsyncAPIHandler TargetRPCA method ptr to the type of Requests this CallData will be servicing.
CallDataStatus
CallStatus CallDataStatusThe current state of the RPC.
Service
ServiceType *ServiceThe service that this CallData is associated with.
CQueue
ServerCompletionQueue *CQueueThe proiducer-consumer completion queue that this CallData is associated with.
bReusable
bool bReusableVariable defining whether we discard this CallData or replace it after serving one RPC.
Default is to disgard