1
0
Fork 0

Fixed RocksDBAllIndexIterator

This commit is contained in:
Simon Grätzer 2017-03-28 14:53:16 +02:00
parent 5e630d818f
commit aa1b443d85
2 changed files with 7 additions and 7 deletions

View File

@ -79,18 +79,18 @@ RocksDBAllIndexIterator::RocksDBAllIndexIterator(
bool reverse)
: IndexIterator(collection, trx, mmdr, index),
_reverse(reverse),
_iterator(index->_keyRevMap.begin()),
_end(index->_keyRevMap.end()) {}
_keyRevMap(index->_keyRevMap),
_iterator(index->_keyRevMap.begin()) {}
bool RocksDBAllIndexIterator::next(TokenCallback const& cb, size_t limit) {
if (limit == 0 || _iterator == _end) {
if (limit == 0 || _iterator == _keyRevMap.end()) {
// No limit no data, or we are actually done. The last call should have
// returned false
TRI_ASSERT(limit > 0); // Someone called with limit == 0. Api broken
return false;
}
while (limit > 0 && _iterator != _end) {
while (limit > 0 && _iterator != _keyRevMap.end()) {
TRI_voc_rid_t revisionId = _iterator->second;
cb(RocksDBToken(revisionId));
@ -98,11 +98,11 @@ bool RocksDBAllIndexIterator::next(TokenCallback const& cb, size_t limit) {
limit--;
_iterator++;
}
return _iterator != _end;
return _iterator != _keyRevMap.end();
}
void RocksDBAllIndexIterator::reset() {
// TODO
_iterator = _keyRevMap.begin();
}
RocksDBAnyIndexIterator::RocksDBAnyIndexIterator(

View File

@ -84,8 +84,8 @@ class RocksDBAllIndexIterator final : public IndexIterator {
private:
bool const _reverse;
std::unordered_map<std::string, TRI_voc_rid_t> const& _keyRevMap;
std::unordered_map<std::string, TRI_voc_rid_t>::const_iterator _iterator;
std::unordered_map<std::string, TRI_voc_rid_t>::const_iterator _end;
//uint64_t _total;
};