LogCabin
|
Used to create RPC::ClientSession objects and then immediately call VerifyRecipient RPCs on them. More...
#include <SessionManager.h>
Classes | |
class | LockedAssignment |
Gets and sets a value while holding a mutex. More... | |
Public Types | |
typedef LockedAssignment < std::string > | ClusterUUID |
typedef LockedAssignment < uint64_t > | ServerId |
Public Member Functions | |
SessionManager (Event::Loop &eventLoop, const Core::Config &config) | |
Construtor. | |
std::shared_ptr < RPC::ClientSession > | createSession (const RPC::Address &address, RPC::Address::TimePoint timeout, ClusterUUID *clusterUUID=NULL, ServerId *serverId=NULL) |
Connect to the given address. | |
Public Attributes | |
Event::Loop & | eventLoop |
Private Attributes | |
const Core::Config & | config |
bool | skipVerify |
Used only for unit testing. |
Used to create RPC::ClientSession objects and then immediately call VerifyRecipient RPCs on them.
TODO(ongaro): Consider encapsulating Backoff mechanism in here as well, since session creation ought to be paired with Backoff.
Definition at line 52 of file SessionManager.h.
typedef LockedAssignment<std::string> LogCabin::Client::SessionManager::ClusterUUID |
Definition at line 129 of file SessionManager.h.
typedef LockedAssignment<uint64_t> LogCabin::Client::SessionManager::ServerId |
Definition at line 130 of file SessionManager.h.
LogCabin::Client::SessionManager::SessionManager | ( | Event::Loop & | eventLoop, |
const Core::Config & | config | ||
) |
Construtor.
Takes a couple of parameters that are common to all sessions so that you don't have to repeatedly provide them to createSession.
eventLoop | Event::Loop that will be used to find out when the session's underlying socket may be read from or written to without blocking. This object keeps a reference. |
config | General settings. This object keeps a reference. |
Definition at line 27 of file SessionManager.cc.
std::shared_ptr< RPC::ClientSession > LogCabin::Client::SessionManager::createSession | ( | const RPC::Address & | address, |
RPC::Address::TimePoint | timeout, | ||
ClusterUUID * | clusterUUID = NULL , |
||
ServerId * | serverId = NULL |
||
) |
Connect to the given address.
address | The RPC server address on which to connect. | |
timeout | After this time has elapsed, stop trying to initiate the connection and leave the session in an error state. | |
[in,out] | clusterUUID | If set, the recipient will confirm that it matches this cluster UUID. If empty and the recipient returns one, this will be set. |
[in,out] | serverId | If set, the recipient will confirm that it has this server ID. If empty and the recipient returns one, this will be set. |
Definition at line 36 of file SessionManager.cc.
Definition at line 166 of file SessionManager.h.
const Core::Config& LogCabin::Client::SessionManager::config [private] |
Definition at line 168 of file SessionManager.h.
bool LogCabin::Client::SessionManager::skipVerify [private] |
Used only for unit testing.
Set to false, normally.
Definition at line 172 of file SessionManager.h.