diff options
Diffstat (limited to 'src/mongo/db/s/metadata_manager.h')
-rw-r--r-- | src/mongo/db/s/metadata_manager.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h index d3625840acd..db0b3b1e255 100644 --- a/src/mongo/db/s/metadata_manager.h +++ b/src/mongo/db/s/metadata_manager.h @@ -25,6 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ + #pragma once #include <list> @@ -32,6 +33,7 @@ #include "mongo/base/disallow_copying.h" #include "mongo/db/s/collection_metadata.h" +#include "mongo/s/catalog/type_chunk.h" namespace mongo { @@ -58,6 +60,26 @@ public: */ void setActiveMetadata(std::unique_ptr<CollectionMetadata> newMetadata); + /** + * Adds a new range to be cleaned up. + * The newly introduced range must not overlap with the existing ranges. + */ + void addRangeToClean(const ChunkRange& range); + + /** + * Removes the specified range from the ranges to be cleaned up. + */ + void removeRangeToClean(const ChunkRange& range); + + /** + * Gets copy of _rangesToClean map (see below). + */ + std::map<BSONObj, ChunkRange> getCopyOfRanges(); + + /* + * Appends information on all the chunk ranges in rangesToClean to builder. + */ + void append(BSONObjBuilder* builder); private: friend class ScopedCollectionMetadata; @@ -82,8 +104,12 @@ private: std::unique_ptr<CollectionMetadataTracker> _activeMetadataTracker; std::list<std::unique_ptr<CollectionMetadataTracker>> _metadataInUse; -}; + // Contains the information of which ranges of sharding keys need to + // be deleted from the shard. The map is from the minimum value of the + // range to be deleted (e.g. BSON("key" << 0)) to the entire chunk range. + std::map<BSONObj, ChunkRange> _rangesToClean; +}; class ScopedCollectionMetadata { MONGO_DISALLOW_COPYING(ScopedCollectionMetadata); |