diff options
| author | Per Larsson <[email protected]> | 2021-12-13 19:46:36 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-13 19:46:36 +0100 |
| commit | 3e666bec6605931114c1d78d48bffeeb75e3e61b (patch) | |
| tree | c8db57d3f2f7f9d6947ad6a6f8ac0b38289e4f77 /zenstore/include | |
| parent | Fixed bug in z$ GC. (diff) | |
| download | zen-3e666bec6605931114c1d78d48bffeeb75e3e61b.tar.xz zen-3e666bec6605931114c1d78d48bffeeb75e3e61b.zip | |
Remove Cid to CAS chunk mapping after GC.
Diffstat (limited to 'zenstore/include')
| -rw-r--r-- | zenstore/include/zenstore/CAS.h | 8 | ||||
| -rw-r--r-- | zenstore/include/zenstore/cidstore.h | 1 | ||||
| -rw-r--r-- | zenstore/include/zenstore/gc.h | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/zenstore/include/zenstore/CAS.h b/zenstore/include/zenstore/CAS.h index 72b750d6c..5f1565f81 100644 --- a/zenstore/include/zenstore/CAS.h +++ b/zenstore/include/zenstore/CAS.h @@ -60,6 +60,14 @@ public: } } + inline void FilterChunks(std::span<const IoHash> Candidates, std::invocable<const IoHash&, bool> auto MatchFunc) + { + for (const IoHash& Candidate : Candidates) + { + MatchFunc(Candidate, ContainsChunk(Candidate)); + } + } + private: // Q: should we protect this with a lock, or is that a higher level concern? std::unordered_set<IoHash> m_ChunkSet; diff --git a/zenstore/include/zenstore/cidstore.h b/zenstore/include/zenstore/cidstore.h index 4dd83f24e..a8cb87f40 100644 --- a/zenstore/include/zenstore/cidstore.h +++ b/zenstore/include/zenstore/cidstore.h @@ -54,6 +54,7 @@ public: bool ContainsChunk(const IoHash& DecompressedId); void Flush(); void Scrub(ScrubContext& Ctx); + void RemoveCids(CasChunkSet& CasChunks); CasStoreSize CasSize() const; // TODO: add batch filter support diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h index fe93456c6..9b0025403 100644 --- a/zenstore/include/zenstore/gc.h +++ b/zenstore/include/zenstore/gc.h @@ -22,6 +22,7 @@ class logger; namespace zen { class CasStore; +class CasChunkSet; class CasGc; class CidStore; struct IoHash; @@ -57,6 +58,10 @@ public: void FilterCids(std::span<const IoHash> Cid, std::function<void(const IoHash&)> KeepFunc); void FilterCas(std::span<const IoHash> Cas, std::function<void(const IoHash&)> KeepFunc); + void FilterCas(std::span<const IoHash> Cas, std::function<void(const IoHash&, bool)>&& FilterFunc); + + void DeletedCas(std::span<const IoHash> Cas); + CasChunkSet& DeletedCas(); std::span<const IoHash> ValidCacheKeys(const std::string& Bucket) const; std::span<const IoHash> ExpiredCacheKeys(const std::string& Bucket) const; @@ -204,4 +209,6 @@ private: std::optional<TriggerParams> m_TriggerParams; }; +void gc_forcelink(); + } // namespace zen |