aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/gc.cpp12
-rw-r--r--zenstore/include/zenstore/gc.h84
2 files changed, 55 insertions, 41 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index c25ea344c..612cceed9 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -80,4 +80,16 @@ CasGc::OnNewCidReferences(std::span<IoHash> Hashes)
ZEN_UNUSED(Hashes);
}
+void
+CasGc::OnCommittedCidReferences(std::span<IoHash> Hashes)
+{
+ ZEN_UNUSED(Hashes);
+}
+
+void
+CasGc::OnDroppedCidReferences(std::span<IoHash> Hashes)
+{
+ ZEN_UNUSED(Hashes);
+}
+
} // namespace zen
diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h
index dda33c9eb..baf13aab1 100644
--- a/zenstore/include/zenstore/gc.h
+++ b/zenstore/include/zenstore/gc.h
@@ -9,61 +9,63 @@
namespace zen {
-class CasStore;
-class CasGc;
-struct IoHash;
+ class CasStore;
+ class CasGc;
+ struct IoHash;
-/** Garbage Collection context object
- */
+ /** Garbage Collection context object
+ */
-class GcContext
-{
-public:
- GcContext();
- ~GcContext();
+ class GcContext
+ {
+ public:
+ GcContext();
+ ~GcContext();
- void ContributeCids(std::span<const IoHash> Cid);
- void ContributeCas(std::span<const IoHash> Hash);
+ void ContributeCids(std::span<const IoHash> Cid);
+ void ContributeCas(std::span<const IoHash> Hash);
-private:
- struct GcState;
+ private:
+ struct GcState;
- std::unique_ptr<GcState> m_State;
-};
+ std::unique_ptr<GcState> m_State;
+ };
-class GcContributor
-{
-public:
- GcContributor(CasGc& Gc);
- ~GcContributor();
+ class GcContributor
+ {
+ public:
+ GcContributor(CasGc& Gc);
+ ~GcContributor();
- virtual void GarbageCollect(GcContext& GcCtx) = 0;
+ virtual void GarbageCollect(GcContext& GcCtx) = 0;
-protected:
- CasGc& m_Gc;
-};
+ protected:
+ CasGc& m_Gc;
+ };
-/** GC
- */
+ /** GC orchestrator
+ */
-class CasGc
-{
-public:
- CasGc(CasStore& Store);
- ~CasGc();
+ class CasGc
+ {
+ public:
+ CasGc(CasStore& Store);
+ ~CasGc();
- void AddGcContributor(GcContributor* Contributor);
- void RemoveGcContributor(GcContributor* Contributor);
+ void AddGcContributor(GcContributor* Contributor);
+ void RemoveGcContributor(GcContributor* Contributor);
- void CollectGarbage();
+ void CollectGarbage();
- void OnNewCidReferences(std::span<IoHash> Hashes);
+ void OnNewCidReferences(std::span<IoHash> Hashes);
+ void OnCommittedCidReferences(std::span<IoHash> Hashes);
+ void OnDroppedCidReferences(std::span<IoHash> Hashes);
-private:
- CasStore& m_CasStore;
- RwLock m_Lock;
- std::vector<GcContributor*> m_GcContribs;
-};
+ private:
+ CasStore& m_CasStore;
+ RwLock m_Lock;
+ std::vector<GcContributor*> m_GcContribs;
+ };
} // namespace zen