diff options
| author | Stefan Boberg <[email protected]> | 2021-11-01 19:03:42 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-11-01 19:03:54 +0100 |
| commit | f3bd5be8beeae2bbc5a0c0612407ce8e72a9b8cf (patch) | |
| tree | 368ce9f28b80900a8e424a697d3b9ee8a46b76f3 /zenstore/gc.cpp | |
| parent | project: fixed logging of new oplog entries (again) to be easier to scan (diff) | |
| download | zen-f3bd5be8beeae2bbc5a0c0612407ce8e72a9b8cf.tar.xz zen-f3bd5be8beeae2bbc5a0c0612407ce8e72a9b8cf.zip | |
gc: added DeletionMode flag to allow gc dry runs
Diffstat (limited to 'zenstore/gc.cpp')
| -rw-r--r-- | zenstore/gc.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp index 3395761d6..c3cb77b69 100644 --- a/zenstore/gc.cpp +++ b/zenstore/gc.cpp @@ -11,6 +11,7 @@ struct GcContext::GcState { CasChunkSet m_CasChunks; CasChunkSet m_CidChunks; + bool m_DeletionMode = true; }; GcContext::GcContext() : m_State(std::make_unique<GcState>()) @@ -45,6 +46,17 @@ GcContext::FilterCas(std::span<const IoHash> Cas, std::function<void(const IoHas m_State->m_CasChunks.FilterChunks(Cas, [&](const IoHash& Hash) { KeepFunc(Hash); }); } +bool +GcContext::IsDeletionMode() const +{ + return m_State->m_DeletionMode; +} +void +GcContext::SetDeletionMode(bool NewState) +{ + m_State->m_DeletionMode = NewState; +} + ////////////////////////////////////////////////////////////////////////// GcContributor::GcContributor(CasGc& Gc) : m_Gc(Gc) @@ -115,6 +127,7 @@ CasGc::CollectGarbage() // First gather reference set GcContext GcCtx; + GcCtx.SetDeletionMode(false); for (GcContributor* Contributor : m_GcContribs) { |