diff options
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 2 | ||||
| -rw-r--r-- | zenstore/include/zenstore/gc.h | 89 |
2 files changed, 46 insertions, 45 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index eb3c1d47a..e28b2b2d8 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -83,7 +83,7 @@ ZenCacheStore::Put(std::string_view InBucket, const IoHash& HashKey, const ZenCa m_DiskLayer.Put(InBucket, HashKey, Value); -#if ZEN_REF_TRACKING +#if ZEN_USE_REF_TRACKING if (Value.Value.GetContentType() == ZenContentType::kCbObject) { if (ValidateCompactBinary(Value.Value, CbValidateMode::All) == CbValidateError::None) 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 - |