CallData
template<class ServiceType, typename RequestType, typename ResponseType>class CallData
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
class ServiceType
typename RequestType
typename ResponseType
Subclassed by: ExchangeCallData<ServiceType, RequestType, ResponseType>
Public Interface
Constructor:
CallData
inline CallData(ServiceType *Service, ServerCompletionQueue *CQueue, AsyncAPIHandler TargetRPC, bool bReusable=false, bool bAutoCreate=true)
Construct a new CallData object.
Parameters:
Service
(ServiceType *
) – [in] The AsyncService that this CallData is associated withCQueue
(ServerCompletionQueue *
) – [in] The completion queue that this CallData will tracked withTargetRPC
(AsyncAPIHandler
) – [in] The method that this CallData will be servicingbReusable
(bool
) – [in] Whether this CallData should be reused after serving one RPCbAutoCreate
(bool
) – [in] Whether this CallData should automatically create itself, or it should happen later via Create()
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 85, column 1)
Public Functions:
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: Schola/Source/Schola/Public/Communicator/CallData.h
(line 100, column 6)
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: Schola/Source/Schola/Public/Communicator/CallData.h
(line 114, column 6)
Reset
inline void Reset()
Reset the RPC state object so it can be reused again by another RPC in the future.
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 131, column 6)
Finish
inline void Finish()
The RPC has been deleted so perform final cleanup.
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 155, column 6)
CleanUp
inline void CleanUp()
clean up, both this object and any other objects owned by it
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 165, column 6)
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
Returns: const RequestType &
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 181, column 19)
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
Returns: ResponseType *
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 190, column 14)
SetResponse
inline void SetResponse(ResponseType *NewResponse)
Set the response message.
Note: Caller must relinquish ownership of the response message
Parameters:
NewResponse
(ResponseType *
) – [in] The new Response message to associate with this call.
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 201, column 6)
HasResponse
inline bool HasResponse()
Has the response message been set already.
Returns: true iff the response message has been set
Returns: bool
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 214, column 13)
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
Returns: bool
Attributes: inline
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 223, column 13)
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: Schola/Source/Schola/Public/Communicator/CallData.h
(line 231, column 6)
Public Members:
int Id
int Id = = 0
The unique ID of this CallData instance.
Used for debugging,
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 75, column 5)
Protected Interface
Protected Members:
ServerContext * SContext
ServerContext * SContext
The Context of the Server that this CallData is associated with.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 39, column 15)
ServerAsyncResponseWriter<ResponseType> Responder
ServerAsyncResponseWriter<ResponseType> Responder
An Object that can be used to send a response to the client.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 42, column 27)
RequestType Request
RequestType Request
The incoming request message from the client.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 45, column 13)
ResponseType * Response
ResponseType * Response = = nullptr
The outgoing response message to the client.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 48, column 14)
AsyncAPIHandler TargetRPC
AsyncAPIHandler TargetRPC
A method ptr to the type of Requests this CallData will be servicing.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 51, column 17)
CallStatus CallDataStatus
CallStatus CallDataStatus
The current state of the RPC.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 62, column 12)
ServiceType * Service
ServiceType * Service
The service that this CallData is associated with.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 65, column 13)
ServerCompletionQueue * CQueue
ServerCompletionQueue * CQueue
The proiducer-consumer completion queue that this CallData is associated with.
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 68, column 23)
bool bReusable
bool bReusable
Variable defining whether we discard this CallData or replace it after serving one RPC.
Default is to disgard
Attributes: protected
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 71, column 6)
Used By: ExchangeCallData
Source: Schola/Source/Schola/Public/Communicator/CallData.h
(line 25, column 1)