aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-06-07 22:27:13 +0200
committerDan Engelbrecht <[email protected]>2022-06-07 22:27:13 +0200
commit3f3e91a6a1721a1a532ed296dd6e830fcfda8118 (patch)
tree887596c8f2c00199df6f722d15576a047c2b9f15 /zenstore/gc.cpp
parentMerge pull request #120 from EpicGames/de/fix-failed-to-finalize-file (diff)
downloadzen-3f3e91a6a1721a1a532ed296dd6e830fcfda8118.tar.xz
zen-3f3e91a6a1721a1a532ed296dd6e830fcfda8118.zip
We need to make each Cache Key contribution per bucket unique even across namespaces
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 8e2d441f8..dfa3d54ab 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -170,15 +170,9 @@ SaveCompactBinaryObject(const fs::path& Path, const CbObject& Object)
struct GcContext::GcState
{
- struct CacheBucket
- {
- std::vector<IoHash> ValidKeys;
- std::vector<IoHash> ExpiredKeys;
- };
-
- using CacheBuckets = std::unordered_map<std::string, CacheBucket>;
+ using CacheKeyContexts = std::unordered_map<std::string, std::vector<IoHash>>;
- CacheBuckets m_CacheBuckets;
+ CacheKeyContexts m_ExpiredCacheKeys;
CasChunkSet m_CasChunks;
CasChunkSet m_DeletedCasChunks;
CasChunkSet m_CidChunks;
@@ -212,9 +206,9 @@ GcContext::ContributeCas(std::span<const IoHash> Cas)
}
void
-GcContext::ContributeCacheKeys(const std::string& Bucket, std::vector<IoHash>&& ExpiredKeys)
+GcContext::ContributeCacheKeys(const std::string& CacheKeyContext, std::vector<IoHash>&& ExpiredKeys)
{
- m_State->m_CacheBuckets[Bucket].ExpiredKeys = std::move(ExpiredKeys);
+ m_State->m_ExpiredCacheKeys[CacheKeyContext] = std::move(ExpiredKeys);
}
void
@@ -254,9 +248,9 @@ GcContext::DeletedCas()
}
std::span<const IoHash>
-GcContext::ExpiredCacheKeys(const std::string& Bucket) const
+GcContext::ExpiredCacheKeys(const std::string& CacheKeyContext) const
{
- return m_State->m_CacheBuckets[Bucket].ExpiredKeys;
+ return m_State->m_ExpiredCacheKeys[CacheKeyContext];
}
bool