diff --git a/src/bucket/BucketListSnapshotBase.cpp b/src/bucket/BucketListSnapshotBase.cpp index 549a52d20e..09fd4fa592 100644 --- a/src/bucket/BucketListSnapshotBase.cpp +++ b/src/bucket/BucketListSnapshotBase.cpp @@ -118,6 +118,41 @@ SearchableBucketListSnapshotBase::load(LedgerKey const& k) const return result; } +template +std::optional> +SearchableBucketListSnapshotBase::loadKeysInternal( + std::set const& inKeys, + LedgerKeyMeter* lkMeter, std::optional ledgerSeq) const +{ + ZoneScoped; + + // Make a copy of the key set, this loop is destructive + auto keys = inKeys; + std::vector entries; + auto loadKeysLoop = [&](auto const& b) { + b.loadKeys(keys, entries, lkMeter); + return keys.empty() ? Loop::COMPLETE : Loop::INCOMPLETE; + }; + + if (!ledgerSeq || *ledgerSeq == mSnapshot->getLedgerSeq()) + { + loopAllBuckets(loadKeysLoop, *mSnapshot); + } + else + { + auto iter = mHistoricalSnapshots.find(*ledgerSeq); + if (iter == mHistoricalSnapshots.end()) + { + return std::nullopt; + } + + releaseAssert(iter->second); + loopAllBuckets(loadKeysLoop, *iter->second); + } + + return entries; +} + template std::optional> SearchableBucketListSnapshotBase::loadKeysFromLedger( diff --git a/src/bucket/SearchableBucketList.cpp b/src/bucket/SearchableBucketList.cpp index 23e010024e..31631ba3b6 100644 --- a/src/bucket/SearchableBucketList.cpp +++ b/src/bucket/SearchableBucketList.cpp @@ -64,41 +64,6 @@ SearchableLiveBucketListSnapshot::scanForEviction( return result; } -template -std::optional> -SearchableBucketListSnapshotBase::loadKeysInternal( - std::set const& inKeys, - LedgerKeyMeter* lkMeter, std::optional ledgerSeq) const -{ - ZoneScoped; - - // Make a copy of the key set, this loop is destructive - auto keys = inKeys; - std::vector entries; - auto loadKeysLoop = [&](auto const& b) { - b.loadKeys(keys, entries, lkMeter); - return keys.empty() ? Loop::COMPLETE : Loop::INCOMPLETE; - }; - - if (!ledgerSeq || *ledgerSeq == mSnapshot->getLedgerSeq()) - { - loopAllBuckets(loadKeysLoop, *mSnapshot); - } - else - { - auto iter = mHistoricalSnapshots.find(*ledgerSeq); - if (iter == mHistoricalSnapshots.end()) - { - return std::nullopt; - } - - releaseAssert(iter->second); - loopAllBuckets(loadKeysLoop, *iter->second); - } - - return entries; -} - // This query has two steps: // 1. For each bucket, determine what PoolIDs contain the target asset via the // assetToPoolID index