mongo::ReplicaSetMonitor Class Reference
#include <dbclient_rs.h>
List of all members.
Detailed Description
manages state about a replica set for client keeps tabs on whose master and what slaves are up can hand a slave to someone for SLAVE_OK one instace per process per replica set TODO: we might be able to use a regular Node * to avoid _lock
Definition at line 35 of file dbclient_rs.h.
Member Typedef Documentation
Constructor & Destructor Documentation
mongo::ReplicaSetMonitor::~ReplicaSetMonitor |
( |
|
) |
|
mongo::ReplicaSetMonitor::ReplicaSetMonitor |
( |
const string & |
name, |
|
|
const vector< HostAndPort > & |
servers | |
|
) |
| | [private] |
This populates a list of hosts from the list of seeds (discarding the seed list).
- Parameters:
-
| name | set name |
| servers | seeds |
Member Function Documentation
void mongo::ReplicaSetMonitor::_check |
( |
|
) |
[private] |
bool mongo::ReplicaSetMonitor::_checkConnection |
( |
DBClientConnection * |
c, |
|
|
string & |
maybePrimary, |
|
|
bool |
verbose | |
|
) |
| | [private] |
Updates host list.
- Parameters:
-
| c | the connection to check |
| maybePrimary | OUT |
| verbose | |
- Returns:
- if the connection is good
void mongo::ReplicaSetMonitor::_checkHosts |
( |
const BSONObj & |
hostList, |
|
|
bool & |
changed | |
|
) |
| | [private] |
Add array of hosts to host list. Doesn't do anything if hosts are already in host list.
- Parameters:
-
| hostList | the list of hosts to add |
| changed | if new hosts were added |
Use replSetGetStatus command to make sure hosts in host list are up and readable. Sets Node::ok appropriately.
int mongo::ReplicaSetMonitor::_find |
( |
const HostAndPort & |
server |
) |
const [private] |
int mongo::ReplicaSetMonitor::_find |
( |
const string & |
server |
) |
const [private] |
void mongo::ReplicaSetMonitor::check |
( |
|
) |
|
checks for current master and new secondaries
static void mongo::ReplicaSetMonitor::checkAll |
( |
|
) |
[static] |
checks all sets for current master and new secondaries usually only called from a BackgroundJob
bool mongo::ReplicaSetMonitor::contains |
( |
const string & |
server |
) |
const |
gets a cached Monitor per name or will create if doesn't exist
string mongo::ReplicaSetMonitor::getName |
( |
|
) |
const [inline] |
string mongo::ReplicaSetMonitor::getServerAddress |
( |
|
) |
const |
- Returns:
- a random slave that is ok for reads
- Returns:
- prev if its still ok, and if not returns a random slave that is ok for reads
void mongo::ReplicaSetMonitor::notifyFailure |
( |
const HostAndPort & |
server |
) |
|
notify the monitor that server has faild
void mongo::ReplicaSetMonitor::notifySlaveFailure |
( |
const HostAndPort & |
server |
) |
|
notify the monitor that server has faild
static void mongo::ReplicaSetMonitor::setConfigChangeHook |
( |
ConfigChangeHook |
hook |
) |
[static] |
this is called whenever the config of any repclia set changes currently only 1 globally asserts if one already exists ownership passes to ReplicaSetMonitor and the hook will actually never be deleted
Member Data Documentation
The documentation for this class was generated from the following file: