Skip to content

Commit

Permalink
move template class member to correct TU for explicit instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Feb 7, 2025
1 parent 036c3fc commit 184c0e9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
35 changes: 35 additions & 0 deletions src/bucket/BucketListSnapshotBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,41 @@ SearchableBucketListSnapshotBase<BucketT>::load(LedgerKey const& k) const
return result;
}

template <class BucketT>
std::optional<std::vector<typename BucketT::LoadT>>
SearchableBucketListSnapshotBase<BucketT>::loadKeysInternal(
std::set<LedgerKey, LedgerEntryIdCmp> const& inKeys,
LedgerKeyMeter* lkMeter, std::optional<uint32_t> ledgerSeq) const
{
ZoneScoped;

// Make a copy of the key set, this loop is destructive
auto keys = inKeys;
std::vector<typename BucketT::LoadT> 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 <class BucketT>
std::optional<std::vector<typename BucketT::LoadT>>
SearchableBucketListSnapshotBase<BucketT>::loadKeysFromLedger(
Expand Down
35 changes: 0 additions & 35 deletions src/bucket/SearchableBucketList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,6 @@ SearchableLiveBucketListSnapshot::scanForEviction(
return result;
}

template <class BucketT>
std::optional<std::vector<typename BucketT::LoadT>>
SearchableBucketListSnapshotBase<BucketT>::loadKeysInternal(
std::set<LedgerKey, LedgerEntryIdCmp> const& inKeys,
LedgerKeyMeter* lkMeter, std::optional<uint32_t> ledgerSeq) const
{
ZoneScoped;

// Make a copy of the key set, this loop is destructive
auto keys = inKeys;
std::vector<typename BucketT::LoadT> 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
Expand Down

0 comments on commit 184c0e9

Please sign in to comment.