aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-21 21:13:13 +0200
committerStefan Boberg <[email protected]>2021-10-21 21:13:13 +0200
commitcb1a2f52e37d9d92a908a8761a7f69d6d33cc4b1 (patch)
treea96e89cfc076d8e8a2f1ceca5d3985cdd3ba0c37 /zenstore/gc.cpp
parentRemoved accidentally committed test code (diff)
downloadzen-cb1a2f52e37d9d92a908a8761a7f69d6d33cc4b1.tar.xz
zen-cb1a2f52e37d9d92a908a8761a7f69d6d33cc4b1.zip
filecas: Added commit log, chunk gc
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 79c646db2..cb03f72ff 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -1,7 +1,7 @@
// Copyright Epic Games, Inc. All Rights Reserved.
-#include <zenstore/gc.h>
#include <zenstore/CAS.h>
+#include <zenstore/gc.h>
namespace zen {
@@ -33,6 +33,18 @@ GcContext::ContributeCas(std::span<const IoHash> Cas)
m_State->m_CasChunks.AddChunksToSet(Cas);
}
+void
+GcContext::FilterCids(std::span<const IoHash> Cid, std::function<void(const IoHash&)> KeepFunc)
+{
+ m_State->m_CidChunks.FilterChunks(Cid, [&](const IoHash& Hash) { KeepFunc(Hash); });
+}
+
+void
+GcContext::FilterCas(std::span<const IoHash> Cas, std::function<void(const IoHash&)> KeepFunc)
+{
+ m_State->m_CasChunks.FilterChunks(Cas, [&](const IoHash& Hash) { KeepFunc(Hash); });
+}
+
//////////////////////////////////////////////////////////////////////////
GcContributor::GcContributor(CasGc& Gc) : m_Gc(Gc)
@@ -67,14 +79,14 @@ CasGc::~CasGc()
{
}
-void
+void
CasGc::AddGcContributor(GcContributor* Contributor)
{
RwLock::ExclusiveLockScope _(m_Lock);
m_GcContribs.push_back(Contributor);
}
-void
+void
CasGc::RemoveGcContributor(GcContributor* Contributor)
{
RwLock::ExclusiveLockScope _(m_Lock);