mongo::BalancerPolicy Class Reference

#include <balancer_policy.h>

List of all members.

Classes

struct  ChunkInfo

Public Types

typedef map< string, vector
< BSONObj > > 
ShardToChunksMap
typedef map< string, BSONObjShardToLimitsMap

Static Public Member Functions

static ChunkInfobalance (const string &ns, const ShardToLimitsMap &shardToLimitsMap, const ShardToChunksMap &shardToChunksMap, int balancedLastTime)
static bool hasOpsQueued (BSONObj shardLimits)
static bool isDraining (BSONObj shardLimits)
static bool isSizeMaxed (BSONObj shardLimits)
static BSONObj pickChunk (const vector< BSONObj > &from, const vector< BSONObj > &to)

Private Types

typedef
ShardToChunksMap::const_iterator 
ShardToChunksIter
typedef
ShardToLimitsMap::const_iterator 
ShardToLimitsIter

Detailed Description

Definition at line 26 of file balancer_policy.h.


Member Typedef Documentation

typedef ShardToChunksMap::const_iterator mongo::BalancerPolicy::ShardToChunksIter [private]

Definition at line 72 of file balancer_policy.h.

typedef map< string,vector<BSONObj> > mongo::BalancerPolicy::ShardToChunksMap

Definition at line 44 of file balancer_policy.h.

typedef ShardToLimitsMap::const_iterator mongo::BalancerPolicy::ShardToLimitsIter [private]

Definition at line 73 of file balancer_policy.h.

Returns a suggested chunk to move whithin a collection's shards, given information about space usage and number of chunks for that collection. If the policy doesn't recommend moving, it returns NULL.

Parameters:
ns is the collections namepace.
shardLimitMap is a map from shardId to an object that describes (for now) space cap and usage. E.g.: { "maxSize" : <size_in_MB> , "usedSize" : <size_in_MB> }.
shardToChunksMap is a map from shardId to chunks that live there. A chunk's format is { }.
balancedLastTime is the number of chunks effectively moved in the last round.
Returns:
NULL or ChunkInfo of the best move to make towards balacing the collection.

Definition at line 28 of file balancer_policy.h.


Member Function Documentation

static ChunkInfo* mongo::BalancerPolicy::balance ( const string &  ns,
const ShardToLimitsMap shardToLimitsMap,
const ShardToChunksMap shardToChunksMap,
int  balancedLastTime 
) [static]
static bool mongo::BalancerPolicy::hasOpsQueued ( BSONObj  shardLimits  )  [static]

Returns true if a shard currently has operations in any of its writeback queues

static bool mongo::BalancerPolicy::isDraining ( BSONObj  shardLimits  )  [static]

Returns true if 'shardLimist' contains a field "draining". Expects the optional field "isDraining" on 'shrdLimits'.

static bool mongo::BalancerPolicy::isSizeMaxed ( BSONObj  shardLimits  )  [static]

Returns true if a shard cannot receive any new chunks bacause it reache 'shardLimits'. Expects the optional fields "maxSize", can in size in MB, and "usedSize", currently used size in MB, on 'shardLimits'.

static BSONObj mongo::BalancerPolicy::pickChunk ( const vector< BSONObj > &  from,
const vector< BSONObj > &  to 
) [static]

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:53 2013