1
0
Fork 0

attempt to fix PrimaryIndexIterator::nextBabies()

This commit is contained in:
Jan Steemann 2016-06-01 16:23:32 +02:00
parent e82ed380e6
commit a624ea4ec5
2 changed files with 40 additions and 0 deletions

View File

@ -93,6 +93,25 @@ TRI_doc_mptr_t* PrimaryIndexIterator::next() {
return nullptr;
}
void PrimaryIndexIterator::nextBabies(std::vector<TRI_doc_mptr_t*>& buffer, size_t limit) {
size_t atMost = limit;
buffer.clear();
while (_iterator.valid() && atMost > 0) {
auto result = _index->lookup(_trx, _iterator.value());
_iterator.next();
if (result == nullptr) {
return;
}
buffer.emplace_back(result);
--atMost;
}
}
void PrimaryIndexIterator::reset() { _iterator.reset(); }
TRI_doc_mptr_t* AllIndexIterator::next() {
@ -102,6 +121,23 @@ TRI_doc_mptr_t* AllIndexIterator::next() {
return _index->findSequential(_trx, _position, _total);
};
void AllIndexIterator::nextBabies(std::vector<TRI_doc_mptr_t*>& buffer, size_t limit) {
size_t atMost = limit;
buffer.clear();
while (atMost > 0) {
auto result = next();
if (result == nullptr) {
return;
}
buffer.emplace_back(result);
--atMost;
}
}
void AllIndexIterator::reset() { _position.reset(); }
TRI_doc_mptr_t* AnyIndexIterator::next() {

View File

@ -56,6 +56,8 @@ class PrimaryIndexIterator final : public IndexIterator {
~PrimaryIndexIterator() {}
TRI_doc_mptr_t* next() override;
void nextBabies(std::vector<TRI_doc_mptr_t*>&, size_t) override;
void reset() override;
@ -79,6 +81,8 @@ class AllIndexIterator final : public IndexIterator {
~AllIndexIterator() {}
TRI_doc_mptr_t* next() override;
void nextBabies(std::vector<TRI_doc_mptr_t*>&, size_t) override;
void reset() override;