diff options
Diffstat (limited to 's/chunk.h')
-rw-r--r-- | s/chunk.h | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/s/chunk.h b/s/chunk.h index cb4650d8273..1e43a3ebc3c 100644 --- a/s/chunk.h +++ b/s/chunk.h @@ -30,6 +30,7 @@ #include "shardkey.h" #include "shard.h" #include "config.h" +#include "util.h" namespace mongo { @@ -40,78 +41,6 @@ namespace mongo { class ChunkRangeMangager; class ChunkObjUnitTest; - struct ShardChunkVersion { - union { - struct { - int _minor; - int _major; - }; - unsigned long long _combined; - }; - - ShardChunkVersion( int major=0, int minor=0 ) - : _minor(minor),_major(major){ - } - - ShardChunkVersion( unsigned long long ll ) - : _combined( ll ){ - } - - ShardChunkVersion( const BSONElement& e ){ - if ( e.type() == Date || e.type() == Timestamp ){ - _combined = e._numberLong(); - } - else if ( e.eoo() ){ - _combined = 0; - } - else { - log() << "ShardChunkVersion can't handle type (" << (int)(e.type()) << ") " << e << endl; - assert(0); - } - } - - ShardChunkVersion incMajor() const { - return ShardChunkVersion( _major + 1 , 0 ); - } - - void operator++(){ - _minor++; - } - - unsigned long long toLong() const { - return _combined; - } - - bool isSet() const { - return _combined > 0; - } - - string toString() const { - stringstream ss; - ss << _major << "|" << _minor; - return ss.str(); - } - - operator unsigned long long() const { return _combined; } - operator string() const { return toString(); } - - ShardChunkVersion& operator=( const BSONElement& elem ){ - switch ( elem.type() ){ - case Timestamp: - case NumberLong: - case Date: - _combined = elem._numberLong(); - break; - case EOO: - _combined = 0; - break; - default: - assert(0); - } - return *this; - } - }; - typedef shared_ptr<Chunk> ChunkPtr; // key is max for each Chunk or ChunkRange |