20 std::shared_ptr<BackendInterface> backend_;
25 CursorFromAccountProvider(
26 std::shared_ptr<BackendInterface> backend,
30 : backend_{std::move(backend)}, numCursors_{numCursors}, pageSize_{pageSize}
34 [[nodiscard]] std::vector<CursorPair>
35 getCursors(uint32_t
const seq)
const override
37 namespace rg = std::ranges;
39 auto accountRoots = [
this, seq]() {
41 return backend_->fetchAccountRoots(numCursors_, pageSize_, seq, yield);
45 rg::sort(accountRoots);
46 std::vector<ripple::uint256> cursors{data::kFIRST_KEY};
47 rg::copy(accountRoots.begin(), accountRoots.end(), std::back_inserter(cursors));
49 cursors.push_back(data::kLAST_KEY);
51 std::vector<CursorPair> pairs;
52 pairs.reserve(cursors.size());
57 std::prev(std::end(cursors)),
58 std::next(std::begin(cursors)),
59 std::back_inserter(pairs),
60 [](
auto&& a,
auto&& b) ->
CursorPair {
return {a, b}; }
auto synchronousAndRetryOnTimeout(FnType &&func)
Synchronously execute the given function object and retry until no DatabaseTimeout is thrown.
Definition BackendInterface.hpp:117