diff options
Diffstat (limited to 'src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp')
-rw-r--r-- | src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp index 3bc907f6721..7053db41a66 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp @@ -357,21 +357,26 @@ public: } } - boost::optional<IndexKeyEntry> seekExact(const BSONObj& key, RequestedInfo) { - auto kv = _seek(key, true, kKeyAndLoc); - if (kv && kv->key.woCompare(key, BSONObj(), /*considerFieldNames*/ false) == 0) + boost::optional<IndexKeyEntry> _seekExact(const BSONObj& key, RequestedInfo parts) { + auto kv = _seek(key, true, parts); + if (!kv || kv->key.woCompare(key, BSONObj(), /*considerFieldNames*/ false) != 0) + return {}; + + if (parts & SortedDataInterface::Cursor::kWantKey) { return kv; - return {}; + } + return IndexKeyEntry{{}, kv->loc}; } - boost::optional<KeyStringEntry> seekExact(const KeyString::Value& keyStringValue) { + boost::optional<KeyStringEntry> seekExactForKeyString( + const KeyString::Value& keyStringValue) override { const BSONObj query = KeyString::toBson(keyStringValue.getBuffer(), keyStringValue.getSize(), _ordering, keyStringValue.getTypeBits()); - auto kv = seekExact(query, kKeyAndLoc); + auto kv = _seekExact(query, kKeyAndLoc); if (kv) { - // We have retrived a valid result from seekExact(). Convert to KeyString + // We have retrived a valid result from _seekExact(). Convert to KeyString // and return KeyString::Builder ks(KeyString::Version::V1, kv->key, _ordering); ks.appendRecordId(kv->loc); @@ -380,6 +385,15 @@ public: return {}; } + boost::optional<IndexKeyEntry> seekExact(const KeyString::Value& keyStringValue, + RequestedInfo parts) override { + const BSONObj query = KeyString::toBson(keyStringValue.getBuffer(), + keyStringValue.getSize(), + _ordering, + keyStringValue.getTypeBits()); + return _seekExact(query, parts); + } + void save() override { // Keep original position if we haven't moved since the last restore. _opCtx = nullptr; |