diff options
author | David Storch <david.storch@10gen.com> | 2015-11-16 15:08:15 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-11-17 15:43:20 -0500 |
commit | 009268e918a1e08d611daad34ec94fa5a351db60 (patch) | |
tree | 23d534eea2fbec3a9efaa8768635560591cc2f83 /src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp | |
parent | 7d0ad1d8e1f4ba8e5b81b0242aae8bd5744530da (diff) | |
download | mongo-009268e918a1e08d611daad34ec94fa5a351db60.tar.gz |
SERVER-21403 plumb flag indicating whether or not index is unique down to MMAPv1 BtreeLogic
Includes similar plumbing for the ephemeralForTest storage
engine. WiredTiger integration layer changes are unnecessary
since WT index cursors are already unique-aware.
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 | 13 |
1 files changed, 8 insertions, 5 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 0029b05374d..75df462418a 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 @@ -138,7 +138,7 @@ private: class EphemeralForTestBtreeImpl : public SortedDataInterface { public: - EphemeralForTestBtreeImpl(IndexSet* data) : _data(data) { + EphemeralForTestBtreeImpl(IndexSet* data, bool isUnique) : _data(data), _isUnique(isUnique) { _currentKeySize = 0; } @@ -224,8 +224,8 @@ public: class Cursor final : public SortedDataInterface::Cursor { public: - Cursor(OperationContext* txn, const IndexSet& data, bool isForward) - : _txn(txn), _data(data), _forward(isForward), _it(data.end()) {} + Cursor(OperationContext* txn, const IndexSet& data, bool isForward, bool isUnique) + : _txn(txn), _data(data), _forward(isForward), _isUnique(isUnique), _it(data.end()) {} boost::optional<IndexKeyEntry> next(RequestedInfo parts) override { if (_lastMoveWasRestore) { @@ -425,6 +425,7 @@ public: OperationContext* _txn; // not owned const IndexSet& _data; const bool _forward; + const bool _isUnique; bool _isEOF = true; IndexSet::const_iterator _it; @@ -449,7 +450,7 @@ public: virtual std::unique_ptr<SortedDataInterface::Cursor> newCursor(OperationContext* txn, bool isForward) const { - return stdx::make_unique<Cursor>(txn, *_data, isForward); + return stdx::make_unique<Cursor>(txn, *_data, isForward, _isUnique); } virtual Status initAsEmpty(OperationContext* txn) { @@ -479,18 +480,20 @@ private: IndexSet* _data; long long _currentKeySize; + const bool _isUnique; }; } // namespace // IndexCatalogEntry argument taken by non-const pointer for consistency with other Btree // factories. We don't actually modify it. SortedDataInterface* getEphemeralForTestBtreeImpl(const Ordering& ordering, + bool isUnique, std::shared_ptr<void>* dataInOut) { invariant(dataInOut); if (!*dataInOut) { *dataInOut = std::make_shared<IndexSet>(IndexEntryComparison(ordering)); } - return new EphemeralForTestBtreeImpl(static_cast<IndexSet*>(dataInOut->get())); + return new EphemeralForTestBtreeImpl(static_cast<IndexSet*>(dataInOut->get()), isUnique); } } // namespace mongo |