aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-05-02 10:53:41 +0200
committerDan Engelbrecht <[email protected]>2022-05-02 10:53:41 +0200
commitdc589650427f2ab444a7ebf78fb59ee751a4c2c8 (patch)
treebf3c37a143bd8707f6e2c0e2b8802f243f523d33 /zenserver/cache
parentrefactor structured cache to use blockstore migrate (diff)
downloadzen-dc589650427f2ab444a7ebf78fb59ee751a4c2c8.tar.xz
zen-dc589650427f2ab444a7ebf78fb59ee751a4c2c8.zip
use std::vector<std::pair>> instead of map
Diffstat (limited to 'zenserver/cache')
-rw-r--r--zenserver/cache/structuredcachestore.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index e9c051f88..9cfb5fbf3 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -156,24 +156,6 @@ namespace {
return BucketDir / (std::string("zen") + LegacyDataExtension);
}
- std::vector<DiskIndexEntry> MakeDiskIndexEntries(const std::unordered_map<IoHash, DiskLocation>& MovedChunks,
- const std::vector<IoHash>& DeletedChunks)
- {
- std::vector<DiskIndexEntry> result;
- result.reserve(MovedChunks.size());
- for (const auto& MovedEntry : MovedChunks)
- {
- result.push_back({.Key = MovedEntry.first, .Location = MovedEntry.second});
- }
- for (const IoHash& ChunkHash : DeletedChunks)
- {
- DiskLocation Location;
- Location.Flags |= DiskLocation::kTombStone;
- result.push_back({.Key = ChunkHash, .Location = Location});
- }
- return result;
- }
-
bool ValidateLegacyEntry(const LegacyDiskIndexEntry& Entry, std::string& OutReason)
{
if (Entry.Key == IoHash::Zero)
@@ -1659,8 +1641,8 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx)
m_PayloadAlignment,
false,
[this, &DeletedChunks, &ChunkIndexToChunkHash, &Index, &ReadBlockTimeUs, &ReadBlockLongestTimeUs](
- const std::unordered_map<size_t, BlockStoreLocation>& MovedChunks,
- const std::vector<size_t>& RemovedChunks) {
+ const std::vector<std::pair<size_t, BlockStoreLocation>>& MovedChunks,
+ const std::vector<size_t>& RemovedChunks) {
std::vector<DiskIndexEntry> LogEntries;
LogEntries.reserve(MovedChunks.size() + RemovedChunks.size());
for (const auto& Entry : MovedChunks)