diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-05-18 18:01:38 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-06-09 16:33:22 -0400 |
commit | 3b731debe162706cbbfabd9578bbb57ab5a7a7d8 (patch) | |
tree | 7b26f5541e5de0060bf75f5563b37cae5a246ee8 /src/mongo/db/storage/record_store_test_manyiter.cpp | |
parent | f50d1d0b7df924926855badd3cd700653f75f0f8 (diff) | |
download | mongo-3b731debe162706cbbfabd9578bbb57ab5a7a7d8.tar.gz |
SERVER-16444 New API for navigating RecordStores
Diffstat (limited to 'src/mongo/db/storage/record_store_test_manyiter.cpp')
-rw-r--r-- | src/mongo/db/storage/record_store_test_manyiter.cpp | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/src/mongo/db/storage/record_store_test_manyiter.cpp b/src/mongo/db/storage/record_store_test_manyiter.cpp index ba31c2109e7..57723e23723 100644 --- a/src/mongo/db/storage/record_store_test_manyiter.cpp +++ b/src/mongo/db/storage/record_store_test_manyiter.cpp @@ -58,19 +58,9 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - vector<RecordIterator*> v = rs->getManyIterators( opCtx.get() ); - - for (vector<RecordIterator*>::iterator vIter = v.begin(); - vIter != v.end(); vIter++) { - - RecordIterator *rIter = *vIter; - ASSERT( rIter->isEOF() ); - ASSERT_EQUALS( RecordId(), rIter->curr() ); - ASSERT_EQUALS( RecordId(), rIter->getNext() ); - ASSERT( rIter->isEOF() ); - ASSERT_EQUALS( RecordId(), rIter->curr() ); - - delete rIter; + for (auto&& cursor : rs->getManyCursors(opCtx.get())) { + ASSERT(!cursor->next()); + ASSERT(!cursor->next()); } } } @@ -113,24 +103,12 @@ namespace mongo { set<RecordId> remain( locs, locs + nToInsert ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - vector<RecordIterator*> v = rs->getManyIterators( opCtx.get() ); - - for (vector<RecordIterator*>::iterator vIter = v.begin(); - vIter != v.end(); vIter++) { - - RecordIterator *rIter = *vIter; - while ( !rIter->isEOF() ) { - RecordId loc = rIter->curr(); - ASSERT( 1 == remain.erase( loc ) ); - ASSERT_EQUALS( loc, rIter->getNext() ); + for (auto&& cursor : rs->getManyCursors(opCtx.get())) { + while (auto record = cursor->next()) { + ASSERT_EQ(remain.erase(record->id), size_t(1)); } - ASSERT_EQUALS( RecordId(), rIter->curr() ); - ASSERT_EQUALS( RecordId(), rIter->getNext() ); - ASSERT( rIter->isEOF() ); - ASSERT_EQUALS( RecordId(), rIter->curr() ); - - delete rIter; + ASSERT(!cursor->next()); } ASSERT( remain.empty() ); } |