aboutsummaryrefslogtreecommitdiff
path: root/zenstore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-19 22:30:12 +0200
committerStefan Boberg <[email protected]>2021-10-19 22:30:12 +0200
commitfd265afc084448530f963820667271c2af52644f (patch)
tree7268132380167735fa35bd4255194d3ff8ebe34d /zenstore/include
parentMerge branch 'gc' of https://github.com/EpicGames/zen into gc (diff)
parentMerge branch 'gc' of https://github.com/EpicGames/zen into gc (diff)
downloadzen-fd265afc084448530f963820667271c2af52644f.tar.xz
zen-fd265afc084448530f963820667271c2af52644f.zip
Merge from main
Diffstat (limited to 'zenstore/include')
-rw-r--r--zenstore/include/zenstore/gc.h84
1 files changed, 43 insertions, 41 deletions
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