diff options
Diffstat (limited to 'src/mongo/s/catalog/type_chunk.h')
-rw-r--r-- | src/mongo/s/catalog/type_chunk.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mongo/s/catalog/type_chunk.h b/src/mongo/s/catalog/type_chunk.h index 9827b5a3a79..96ee1588a6a 100644 --- a/src/mongo/s/catalog/type_chunk.h +++ b/src/mongo/s/catalog/type_chunk.h @@ -83,9 +83,25 @@ public: bool operator==(const ChunkRange& other) const; bool operator!=(const ChunkRange& other) const; + /** + * Returns true iff the union of *this and the argument range is the same as *this. + */ + bool covers(ChunkRange const& other) const; + + /** + * Returns the range of overlap between *this and other, if any. + */ + boost::optional<ChunkRange> overlapWith(ChunkRange const& other) const; + + /** + * Returns a range that includes *this and other. If the ranges do not overlap, it includes + * all the space between, as well. + */ + ChunkRange unionWith(ChunkRange const& other) const; + private: - BSONObj _minKey; - BSONObj _maxKey; + const BSONObj _minKey; + const BSONObj _maxKey; }; /** |