MongoDB  2.1.1-pre-
Classes | Public Types | Public Member Functions | Static Public Member Functions
mongo::ReplicaSetMonitor Class Reference

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 More...

#include <dbclient_rs.h>

List of all members.

Classes

struct  Node

Public Types

typedef boost::function1< void,
const ReplicaSetMonitor * > 
ConfigChangeHook

Public Member Functions

HostAndPort getMaster ()
void notifyFailure (const HostAndPort &server)
 notify the monitor that server has faild
HostAndPort getSlave (const HostAndPort &prev)
HostAndPort getSlave ()
void notifySlaveFailure (const HostAndPort &server)
 notify the monitor that server has faild
void check (bool checkAllSecondaries)
 checks for current master and new secondaries
string getName () const
string getServerAddress () const
bool contains (const string &server) const
void appendInfo (BSONObjBuilder &b) const

Static Public Member Functions

static ReplicaSetMonitorPtr get (const string &name, const vector< HostAndPort > &servers)
 gets a cached Monitor per name or will create if doesn't exist
static ReplicaSetMonitorPtr get (const string &name)
 gets a cached Monitor per name or will return none if it doesn't exist
static void checkAll (bool checkAllSecondaries)
 checks all sets for current master and new secondaries usually only called from a BackgroundJob
static void setConfigChangeHook (ConfigChangeHook hook)
 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

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


Member Function Documentation

Returns:
HostAndPort or throws an exception
Returns:
prev if its still ok, and if not returns a random slave that is ok for reads
Returns:
a random slave that is ok for reads

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