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.
|
||||
_cache.clear();
|
||||
} else {
|
||||
cursor->getMoreTokens(_cache, 1000);
|
||||
auto cb = [&] (DocumentIdentifierToken const& token) {
|
||||
_cache.emplace_back(token);
|
||||
};
|
||||
cursor->getMore(cb, 1000);
|
||||
}
|
||||
} while (_cache.empty());
|
||||
|
||||
|
@ -155,15 +158,12 @@ bool SingleServerEdgeCursor::readAll(std::unordered_set<VPackSlice>& result,
|
|||
auto& cursorSet = _cursors[_currentCursor];
|
||||
for (auto& cursor : cursorSet) {
|
||||
LogicalCollection* collection = cursor->collection();
|
||||
while (cursor->hasMore()) {
|
||||
// NOTE: We cannot clear the cache,
|
||||
// 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());
|
||||
}
|
||||
auto cb = [&] (DocumentIdentifierToken const& token) {
|
||||
if (collection->readDocument(_trx, *_mmdr, token)) {
|
||||
result.emplace(_mmdr->vpack());
|
||||
}
|
||||
};
|
||||
while (cursor->getMore(cb, 1000)) {
|
||||
}
|
||||
}
|
||||
_currentCursor++;
|
||||
|
|
Loading…
Reference in New Issue