summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/index_catalog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/index_catalog.cpp')
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 5d0a88b0a9b..90209b6bdc1 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -39,6 +39,7 @@ namespace mongo {
using IndexIterator = IndexCatalog::IndexIterator;
using ReadyIndexesIterator = IndexCatalog::ReadyIndexesIterator;
using AllIndexesIterator = IndexCatalog::AllIndexesIterator;
+using ShardKeyIndex = IndexCatalog::ShardKeyIndex;
bool IndexIterator::more() {
if (_start) {
@@ -101,6 +102,25 @@ const IndexCatalogEntry* AllIndexesIterator::_advance() {
return entry;
}
+ShardKeyIndex::ShardKeyIndex(const IndexDescriptor* indexDescriptor)
+ : _indexDescriptor(indexDescriptor) {
+ tassert(6012300,
+ "The indexDescriptor for ShardKeyIndex(const IndexDescriptor* indexDescripto) must not "
+ "be a nullptr",
+ indexDescriptor != nullptr);
+}
+
+ShardKeyIndex::ShardKeyIndex(const ClusteredIndexSpec& clusteredIndexSpec)
+ : _indexDescriptor(nullptr),
+ _clusteredIndexKeyPattern(clusteredIndexSpec.getKey().getOwned()) {}
+
+const BSONObj& ShardKeyIndex::keyPattern() const {
+ if (_indexDescriptor != nullptr) {
+ return _indexDescriptor->keyPattern();
+ }
+ return _clusteredIndexKeyPattern;
+}
+
StringData toString(IndexBuildMethod method) {
switch (method) {
case IndexBuildMethod::kHybrid: