MemCacheClient
Private Types | Private Member Functions | Private Attributes | Static Private Attributes

MemCacheClient::Server Class Reference

Abstraction of a server connection. More...

Inheritance diagram for MemCacheClient::Server:
Socket

List of all members.

Private Types

enum  ConnectResult { CONNECT_SUCCESS, CONNECT_FAILED, CONNECT_WAITING }

Private Member Functions

mIp (INADDR_NONE)
mPort (0)
mLastConnect (0)
 Server (const Server &rhs)
 copy constructor
 ~Server ()
 destructor
Serveroperator= (const Server &rhs)
 copy operator
bool operator== (const Server &rhs) const
 equality based on server listen address
bool operator!= (const Server &rhs) const
 inequality based on server listen address
bool Set (const char *aServer)
 Set the listen address for this server.
ConnectResult Connect (size_t aTimeout, size_t aRetryPeriod)
 Attempt to connect to the server.
const char * GetAddress () const
 Get the string representation of this server listen address.
int GetPort () const
 Get the listen port for this server.

Private Attributes

__pad0__:/src/MemCacheClient/MemCacheClient.cpp" 2"D:/src/MemCacheClient/MemCacheClient.cpp" 2public: Server(const ClTrace & aTrace) : Socket(aTrace)
char mAddress [ADDRLEN]
 server IP:PORT as string
unsigned long mIp
 server IP address
int mPort
 server port
unsigned long mLastConnect
 last connection time

Static Private Attributes

static const size_t ADDRLEN = sizeof("aaa.bbb.ccc.ddd:PPPPP")
 max length of a server address

Detailed Description

Abstraction of a server connection.

Definition at line 42 of file MemCacheClient.cpp.


Constructor & Destructor Documentation

MemCacheClient::Server::Server ( const Server rhs) [inline, private]

copy constructor

Parameters:
rhsserver to copy address of

Definition at line 60 of file MemCacheClient.cpp.


Member Function Documentation

MemCacheClient::Server::ConnectResult MemCacheClient::Server::Connect ( size_t  aTimeout,
size_t  aRetryPeriod 
) [private]

Attempt to connect to the server.

Parameters:
aTimeoutTimeout for connection in milliseconds
Returns:
true if connection was successful

Definition at line 169 of file MemCacheClient.cpp.

References Socket::Connect(), and Socket::IsConnected().

Referenced by MemCacheClient::FindServer(), and MemCacheClient::FlushAll().

const char* MemCacheClient::Server::GetAddress ( ) const [inline, private]

Get the string representation of this server listen address.

This may not be the same as the address passed in. It will always be in the format IP:PORT.

Returns:
Server listen address as IP:PORT

Definition at line 103 of file MemCacheClient.cpp.

Referenced by MemCacheClient::AddServer(), MemCacheClient::Combine(), MemCacheClient::DumpTables(), MemCacheClient::IncDec(), MemCacheClient::ConsistentHash::operator<(), and MemCacheClient::Store().

bool MemCacheClient::Server::operator!= ( const Server rhs) const [inline, private]

inequality based on server listen address

Parameters:
rhsserver to compare to
Returns:
true when servers are not using the same listen address

Definition at line 80 of file MemCacheClient.cpp.

MemCacheClient::Server & MemCacheClient::Server::operator= ( const Server rhs) [private]

copy operator

Parameters:
rhsserver to copy server listen address from

Definition at line 117 of file MemCacheClient.cpp.

References mAddress, mIp, mLastConnect, mPort, and Socket::mTrace.

bool MemCacheClient::Server::operator== ( const Server rhs) const [private]

equality based on server listen address

Parameters:
rhsserver to compare to
Returns:
true when servers are using the same listen address

Definition at line 132 of file MemCacheClient.cpp.

References mIp, and mPort.

bool MemCacheClient::Server::Set ( const char *  aServer) [private]

Set the listen address for this server.

Parameters:
aServerListen address in IP:PORT format
Returns:
true if listen address was correctly parsed

Definition at line 140 of file MemCacheClient.cpp.

Referenced by MemCacheClient::AddServer(), MemCacheClient::DelServer(), and MemCacheClient::FlushAll().


The documentation for this class was generated from the following file: