#include <balancer_policy.h>
Classes | |
struct | ChunkInfo |
Public Types | |
typedef map< string, vector < BSONObj > > | ShardToChunksMap |
typedef map< string, BSONObj > | ShardToLimitsMap |
Static Public Member Functions | |
static ChunkInfo * | balance (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 |
Definition at line 26 of file balancer_policy.h.
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.
typedef map< string,BSONObj > mongo::BalancerPolicy::ShardToLimitsMap |
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.
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. |
Definition at line 28 of file balancer_policy.h.
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] |