LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
LogCabin::RPC::OpaqueServerRPC Class Reference

This class represents the server side of a remote procedure call. More...

#include <OpaqueServerRPC.h>

List of all members.

Public Member Functions

 OpaqueServerRPC ()
 Default constructor for empty RPC that can't be replied to.
 OpaqueServerRPC (OpaqueServerRPC &&other)
 Move constructor.
 ~OpaqueServerRPC ()
 Destructor.
OpaqueServerRPCoperator= (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 &)
OpaqueServerRPCoperator= (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::BufferresponseTarget
 This is used in unit testing only.

Friends

class OpaqueServer

Detailed Description

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.


Constructor & Destructor Documentation

Constructor for OpaqueServerRPC.

This is called by OpaqueServer.

Parameters:
socketThe socket on which to send the reply.
messageIdThe message ID received with the request.
requestThe 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.


Member Function Documentation

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]

Friends And Related Function Documentation

friend class OpaqueServer [friend]

Definition at line 119 of file OpaqueServerRPC.h.


Member Data Documentation

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.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines