diff options
author | Eric Cox <eric.cox@mongodb.com> | 2020-10-02 18:59:55 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-12-01 21:03:49 +0000 |
commit | 664e5759c78489a88e66e587c34e5f7127c7eebf (patch) | |
tree | 898dde369a563772009f4030d730e0ae18510bec /src/mongo/db/exec/shard_filterer_impl.h | |
parent | a71a2a8bfecf7de0807a28e3eabf9412dddd4258 (diff) | |
download | mongo-664e5759c78489a88e66e587c34e5f7127c7eebf.tar.gz |
SERVER-50712 Handle shard filtering in SBE
Diffstat (limited to 'src/mongo/db/exec/shard_filterer_impl.h')
-rw-r--r-- | src/mongo/db/exec/shard_filterer_impl.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mongo/db/exec/shard_filterer_impl.h b/src/mongo/db/exec/shard_filterer_impl.h index c0ae10529d1..c0b4ef3e0ca 100644 --- a/src/mongo/db/exec/shard_filterer_impl.h +++ b/src/mongo/db/exec/shard_filterer_impl.h @@ -39,20 +39,24 @@ class ShardFiltererImpl : public ShardFilterer { public: ShardFiltererImpl(ScopedCollectionFilter collectionFilter); - DocumentBelongsResult documentBelongsToMe(const WorkingSetMember& wsm) const override; - DocumentBelongsResult documentBelongsToMe(const Document& doc) const override; + std::unique_ptr<ShardFilterer> clone() const override; + + DocumentBelongsResult documentBelongsToMe(const BSONObj& doc) const override; + DocumentBelongsResult documentBelongsToMe(const WorkingSetMember& wsm) const; + + bool keyBelongsToMe(const BSONObj& shardKey) const override { + return _collectionFilter.keyBelongsToMe(shardKey); + }; bool isCollectionSharded() const override { return _collectionFilter.isSharded(); } - const KeyPattern& getKeyPattern() const override { - invariant(_keyPattern); - return _keyPattern->getKeyPattern(); - } + const KeyPattern& getKeyPattern() const override; private: - DocumentBelongsResult _shardKeyBelongsToMe(BSONObj shardKey) const; + DocumentBelongsResult keyBelongsToMeHelper(const BSONObj& doc) const; + ScopedCollectionFilter _collectionFilter; boost::optional<ShardKeyPattern> _keyPattern; }; |