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

Used to create RPC::ClientSession objects and then immediately call VerifyRecipient RPCs on them. More...

#include <SessionManager.h>

List of all members.

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::LoopeventLoop

Private Attributes

const Core::Configconfig
bool skipVerify
 Used only for unit testing.

Detailed Description

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.


Member Typedef Documentation

Definition at line 129 of file SessionManager.h.

Definition at line 130 of file SessionManager.h.


Constructor & Destructor Documentation

Construtor.

Takes a couple of parameters that are common to all sessions so that you don't have to repeatedly provide them to createSession.

Parameters:
eventLoopEvent::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.
configGeneral settings. This object keeps a reference.

Definition at line 27 of file SessionManager.cc.


Member Function Documentation

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.

Parameters:
addressThe RPC server address on which to connect.
timeoutAfter this time has elapsed, stop trying to initiate the connection and leave the session in an error state.
[in,out]clusterUUIDIf set, the recipient will confirm that it matches this cluster UUID. If empty and the recipient returns one, this will be set.
[in,out]serverIdIf 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.


Member Data Documentation

Definition at line 166 of file SessionManager.h.

Definition at line 168 of file SessionManager.h.

Used only for unit testing.

Set to false, normally.

Definition at line 172 of file SessionManager.h.


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