diff options
| author | Stefan Boberg <[email protected]> | 2021-10-19 22:33:44 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-19 22:33:44 +0200 |
| commit | b5d2318c8e54b21e61dd6b3e77137dae6593b981 (patch) | |
| tree | 3976a242186085138d7f067f431075ae22c215e7 /zenstore/include | |
| parent | Merge from main (diff) | |
| download | zen-b5d2318c8e54b21e61dd6b3e77137dae6593b981.tar.xz zen-b5d2318c8e54b21e61dd6b3e77137dae6593b981.zip | |
gc: Made ref tracking optional on `ZEN_USE_REF_TRACKING`
Ref tracking is not fully functional anyway
Diffstat (limited to 'zenstore/include')
| -rw-r--r-- | zenstore/include/zenstore/gc.h | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/zenstore/include/zenstore/gc.h b/zenstore/include/zenstore/gc.h index baf13aab1..70d48722b 100644 --- a/zenstore/include/zenstore/gc.h +++ b/zenstore/include/zenstore/gc.h @@ -7,65 +7,66 @@ #include <span> +#define ZEN_USE_REF_TRACKING 0 // This is not currently functional + 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 orchestrator - */ +/** 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 OnCommittedCidReferences(std::span<IoHash> Hashes); - void OnDroppedCidReferences(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 - |