summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/scoped_collection_metadata.h
diff options
context:
space:
mode:
authorMarcos José Grillo Ramírez <marcos.grillo@mongodb.com>2020-01-30 12:18:48 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-03 12:17:22 +0000
commitf9623edb15c177597c338b10a50ef557ea31131c (patch)
treeae6803d85db9564901598ce7de5d01ece2f4b919 /src/mongo/db/s/scoped_collection_metadata.h
parentb5134bcb006e74e2102de6e171a28931f84ea12f (diff)
downloadmongo-f9623edb15c177597c338b10a50ef557ea31131c.tar.gz
SERVER-45778 Rename getOrphanFilter to getOwnershipFilter and change the return type
Diffstat (limited to 'src/mongo/db/s/scoped_collection_metadata.h')
-rw-r--r--src/mongo/db/s/scoped_collection_metadata.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mongo/db/s/scoped_collection_metadata.h b/src/mongo/db/s/scoped_collection_metadata.h
index 31ef088066f..946170074c4 100644
--- a/src/mongo/db/s/scoped_collection_metadata.h
+++ b/src/mongo/db/s/scoped_collection_metadata.h
@@ -64,8 +64,37 @@ public:
return get();
}
-private:
+ bool isSharded() const {
+ return _impl->get().isSharded();
+ }
+
+ const BSONObj& getKeyPattern() const {
+ return _impl->get().getKeyPattern();
+ }
+
+ const BSONObj extractShardKeyFromDoc(const BSONObj& doc) const {
+ return _impl->get().getChunkManager()->getShardKeyPattern().extractShardKeyFromDoc(doc);
+ }
+
+protected:
std::shared_ptr<Impl> _impl;
};
+class ScopedCollectionFilter : public ScopedCollectionMetadata {
+public:
+ ScopedCollectionFilter(std::shared_ptr<Impl> impl)
+ : ScopedCollectionMetadata(std::move(impl)) {}
+
+ ScopedCollectionFilter(ScopedCollectionMetadata&& scopedMetadata)
+ : ScopedCollectionMetadata(std::move(scopedMetadata)) {}
+
+ bool keyBelongsToMe(const BSONObj& key) const {
+ return _impl->get().keyBelongsToMe(key);
+ }
+
+ Chunk findIntersectingChunkWithSimpleCollation(const BSONObj& shardKey) const {
+ return _impl->get().getChunkManager()->findIntersectingChunkWithSimpleCollation(shardKey);
+ }
+};
+
} // namespace mongo