mirror of https://gitee.com/bigwinds/arangodb
Replaced SingleServer EdgeCursor mit Callback based OpCursor API. This class is NOT future-proof. It assumes that Slice addresses stay valid
This commit is contained in:
parent
d2b82165e2
commit
d250a3e12d
|
@ -121,7 +121,10 @@ bool SingleServerEdgeCursor::next(std::vector<VPackSlice>& result,
|
||||||
// If we switch the cursor. We have to clear the cache.
|
// If we switch the cursor. We have to clear the cache.
|
||||||
_cache.clear();
|
_cache.clear();
|
||||||
} else {
|
} else {
|
||||||
cursor->getMoreTokens(_cache, 1000);
|
auto cb = [&] (DocumentIdentifierToken const& token) {
|
||||||
|
_cache.emplace_back(token);
|
||||||
|
};
|
||||||
|
cursor->getMore(cb, 1000);
|
||||||
}
|
}
|
||||||
} while (_cache.empty());
|
} while (_cache.empty());
|
||||||
|
|
||||||
|
@ -155,15 +158,12 @@ bool SingleServerEdgeCursor::readAll(std::unordered_set<VPackSlice>& result,
|
||||||
auto& cursorSet = _cursors[_currentCursor];
|
auto& cursorSet = _cursors[_currentCursor];
|
||||||
for (auto& cursor : cursorSet) {
|
for (auto& cursor : cursorSet) {
|
||||||
LogicalCollection* collection = cursor->collection();
|
LogicalCollection* collection = cursor->collection();
|
||||||
while (cursor->hasMore()) {
|
auto cb = [&] (DocumentIdentifierToken const& token) {
|
||||||
// NOTE: We cannot clear the cache,
|
if (collection->readDocument(_trx, *_mmdr, token)) {
|
||||||
// because the cursor expect's it to be filled.
|
|
||||||
cursor->getMoreTokens(_cache, 1000);
|
|
||||||
for (auto const& element : _cache) {
|
|
||||||
if (collection->readDocument(_trx, *_mmdr, element)) {
|
|
||||||
result.emplace(_mmdr->vpack());
|
result.emplace(_mmdr->vpack());
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
while (cursor->getMore(cb, 1000)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_currentCursor++;
|
_currentCursor++;
|
||||||
|
|
Loading…
Reference in New Issue