mongo::Grid Class Reference

#include <grid.h>

List of all members.

Public Member Functions

bool addShard (string *name, const ConnectionString &servers, long long maxSize, string &errMsg)
bool allowLocalHost () const
DBConfigPtr getDBConfig (string ns, bool create=true, const string &shardNameHint="")
unsigned long long getNextOpTime () const
 Grid ()
bool knowAboutShard (const string &name) const
void removeDB (string db)
void setAllowLocalHost (bool allow)
bool shouldBalance () const

Static Public Member Functions

static bool _inBalancingWindow (const BSONObj &balancerDoc, const boost::posix_time::ptime &now)

Private Member Functions

bool _getNewShardName (string *name) const

Static Private Member Functions

static bool _balancerStopped (const BSONObj &balancerDoc)
static bool _isSpecialLocalDB (const string &dbName)

Private Attributes

bool _allowLocalShard
map< string, DBConfigPtr_databases
mongo::mutex _lock

Detailed Description

stores meta-information about the grid TODO: used shard_ptr for DBConfig pointers

Definition at line 34 of file grid.h.


Constructor & Destructor Documentation

mongo::Grid::Grid (  )  [inline]

Definition at line 36 of file grid.h.


Member Function Documentation

static bool mongo::Grid::_balancerStopped ( const BSONObj balancerDoc  )  [static, private]
Parameters:
balancerDoc bson that may contain a marker to stop the balancer format { ... , stopped: [ "true" | "false" ] , ... }
Returns:
true if the marker is present and is set to true
bool mongo::Grid::_getNewShardName ( string *  name  )  const [private]
Parameters:
name is the chose name for the shard. Parameter is mandatory.
Returns:
true if it managed to generate a shard name. May return false if (currently) 10000 shard
static bool mongo::Grid::_inBalancingWindow ( const BSONObj balancerDoc,
const boost::posix_time::ptime &  now 
) [static]
Parameters:
balancerDoc bson that may contain a window of time for the balancer to work format { ... , activeWindow: { start: "8:30" , stop: "19:00" } , ... }
Returns:
true if there is no window of time specified for the balancer or it we're currently in it
static bool mongo::Grid::_isSpecialLocalDB ( const string &  dbName  )  [static, private]
Returns:
whether a give dbname is used for shard "local" databases (e.g., admin or local)
bool mongo::Grid::addShard ( string *  name,
const ConnectionString servers,
long long  maxSize,
string &  errMsg 
)

addShard will create a new shard in the grid. It expects a mongod process to be runing on the provided address. Adding a shard that is a replica set is supported.

Parameters:
name is an optional string with the name of the shard. if ommited, grid will generate one and update the parameter.
servers is the connection string of the shard being added
maxSize is the optional space quota in bytes. Zeros means there's no limitation to space usage
errMsg is the error description in case the operation failed.
Returns:
true if shard was successfully added.
bool mongo::Grid::allowLocalHost (  )  const
Returns:
true if shards and config servers are allowed to use 'localhost' in address
DBConfigPtr mongo::Grid::getDBConfig ( string  ns,
bool  create = true,
const string &  shardNameHint = "" 
)

gets the config the db. will return an empty DBConfig if not in db already

unsigned long long mongo::Grid::getNextOpTime (  )  const
bool mongo::Grid::knowAboutShard ( const string &  name  )  const
Returns:
true if the config database knows about a host 'name'
void mongo::Grid::removeDB ( string  db  ) 

removes db entry. on next getDBConfig call will fetch from db

void mongo::Grid::setAllowLocalHost ( bool  allow  ) 
Parameters:
whether to allow shards and config servers to use 'localhost' in address
bool mongo::Grid::shouldBalance (  )  const
Returns:
true if the chunk balancing functionality is enabled

Member Data Documentation

Definition at line 99 of file grid.h.

map<string, DBConfigPtr > mongo::Grid::_databases [private]

Definition at line 98 of file grid.h.

Definition at line 97 of file grid.h.


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


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:55 2013