LogCabin
|
This class represents the server side of a remote procedure call. More...
#include <OpaqueServerRPC.h>
Public Member Functions | |
OpaqueServerRPC () | |
Default constructor for empty RPC that can't be replied to. | |
OpaqueServerRPC (OpaqueServerRPC &&other) | |
Move constructor. | |
~OpaqueServerRPC () | |
Destructor. | |
OpaqueServerRPC & | operator= (OpaqueServerRPC &&other) |
Move assignment. | |
void | closeSession () |
Close the session on which this request originated. | |
void | sendReply () |
Send the response back to the client. | |
Public Attributes | |
Core::Buffer | request |
The RPC request received from the client. | |
Core::Buffer | response |
The reply to the RPC, to send back to the client. | |
Private Member Functions | |
OpaqueServerRPC (std::weak_ptr< OpaqueServer::SocketWithHandler > socket, MessageSocket::MessageId messageId, Core::Buffer request) | |
Constructor for OpaqueServerRPC. | |
OpaqueServerRPC (const OpaqueServerRPC &) | |
OpaqueServerRPC & | operator= (const OpaqueServerRPC &) |
Private Attributes | |
std::weak_ptr < OpaqueServer::SocketWithHandler > | socket |
The socket on which to send the reply. | |
MessageSocket::MessageId | messageId |
The message ID received with the request. | |
Core::Buffer * | responseTarget |
This is used in unit testing only. | |
Friends | |
class | OpaqueServer |
This class represents the server side of a remote procedure call.
An OpaqueServer returns an instance when an RPC is initiated. This is used to send the reply.
This class may be used from any thread, but each object is meant to be accessed by only one thread at a time.
Definition at line 36 of file OpaqueServerRPC.h.
LogCabin::RPC::OpaqueServerRPC::OpaqueServerRPC | ( | std::weak_ptr< OpaqueServer::SocketWithHandler > | socket, |
MessageSocket::MessageId | messageId, | ||
Core::Buffer | request | ||
) | [private] |
Constructor for OpaqueServerRPC.
This is called by OpaqueServer.
socket | The socket on which to send the reply. |
messageId | The message ID received with the request. |
request | The RPC request received from the client. |
Definition at line 30 of file OpaqueServerRPC.cc.
Default constructor for empty RPC that can't be replied to.
This is useful as a placeholder for a real OpaqueServerRPC.
Definition at line 21 of file OpaqueServerRPC.cc.
Move constructor.
Definition at line 42 of file OpaqueServerRPC.cc.
Destructor.
Definition at line 51 of file OpaqueServerRPC.cc.
LogCabin::RPC::OpaqueServerRPC::OpaqueServerRPC | ( | const OpaqueServerRPC & | ) | [private] |
OpaqueServerRPC & LogCabin::RPC::OpaqueServerRPC::operator= | ( | OpaqueServerRPC && | other | ) |
Move assignment.
Definition at line 56 of file OpaqueServerRPC.cc.
Close the session on which this request originated.
This is an impolite thing to do to a client but can be useful occasionally, for example for testing.
Definition at line 67 of file OpaqueServerRPC.cc.
Send the response back to the client.
This will reset response to an empty state, and further replies on this object will not do anything.
Definition at line 77 of file OpaqueServerRPC.cc.
OpaqueServerRPC& LogCabin::RPC::OpaqueServerRPC::operator= | ( | const OpaqueServerRPC & | ) | [private] |
friend class OpaqueServer [friend] |
Definition at line 119 of file OpaqueServerRPC.h.
The RPC request received from the client.
Definition at line 91 of file OpaqueServerRPC.h.
The reply to the RPC, to send back to the client.
Definition at line 96 of file OpaqueServerRPC.h.
std::weak_ptr<OpaqueServer::SocketWithHandler> LogCabin::RPC::OpaqueServerRPC::socket [private] |
The socket on which to send the reply.
Definition at line 102 of file OpaqueServerRPC.h.
The message ID received with the request.
This should be sent back to the client with the response so that the client can match up the response with the right ClientRPC object.
Definition at line 109 of file OpaqueServerRPC.h.
This is used in unit testing only.
During normal operation, this is always NULL. If this is not NULL when sendReply() is invoked, the reply will be moved here.
Definition at line 116 of file OpaqueServerRPC.h.