aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/filecas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-09-23 19:19:40 +0200
committerGitHub Enterprise <[email protected]>2024-09-23 19:19:40 +0200
commitbc9e590727211d803cce7be84c1cbc026179b841 (patch)
tree96d89b59cdced94ce1d795cd941d35d26f6c5e88 /src/zenstore/filecas.cpp
parentmade fmt formatter format function const (#162) (diff)
downloadzen-bc9e590727211d803cce7be84c1cbc026179b841.tar.xz
zen-bc9e590727211d803cce7be84c1cbc026179b841.zip
gc unused refactor (#165)
* optimize IoHash and OId comparisions * refactor filtering of unused references * add attachment filtering to gc
Diffstat (limited to 'src/zenstore/filecas.cpp')
-rw-r--r--src/zenstore/filecas.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp
index 733140e50..7bd17ee88 100644
--- a/src/zenstore/filecas.cpp
+++ b/src/zenstore/filecas.cpp
@@ -1653,9 +1653,9 @@ public:
NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
});
- std::vector<IoHash> UnusedCids = GetUnusedReferences(m_Cids);
- Stats.CheckedCount = m_Cids.size();
- Stats.FoundCount = UnusedCids.size();
+ std::span<IoHash> UnusedCids = GetUnusedReferences(m_Cids);
+ Stats.CheckedCount = m_Cids.size();
+ Stats.FoundCount = UnusedCids.size();
if (UnusedCids.empty())
{
// Nothing to collect
@@ -1699,7 +1699,7 @@ public:
}
}
- return new FileCasStoreCompactor(m_FileCasStrategy, std::move(UnusedCids));
+ return new FileCasStoreCompactor(m_FileCasStrategy, std::vector<IoHash>(UnusedCids.begin(), UnusedCids.end()));
}
private:
@@ -1745,7 +1745,11 @@ FileCasStrategy::CreateReferencePruner(GcCtx& Ctx, GcReferenceStoreStats&)
CidsToCheck.push_back(It.first);
}
}
- return new FileCasReferencePruner(*this, std::move(CidsToCheck));
+ if (FilterReferences(Ctx, CidsToCheck))
+ {
+ return new FileCasReferencePruner(*this, std::move(CidsToCheck));
+ }
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////