diff options
| author | Stefan Boberg <[email protected]> | 2021-10-19 22:30:12 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-19 22:30:12 +0200 |
| commit | fd265afc084448530f963820667271c2af52644f (patch) | |
| tree | 7268132380167735fa35bd4255194d3ff8ebe34d | |
| parent | Merge branch 'gc' of https://github.com/EpicGames/zen into gc (diff) | |
| parent | Merge branch 'gc' of https://github.com/EpicGames/zen into gc (diff) | |
| download | zen-fd265afc084448530f963820667271c2af52644f.tar.xz zen-fd265afc084448530f963820667271c2af52644f.zip | |
Merge from main
| -rw-r--r-- | zenserver/diag/logging.cpp | 4 | ||||
| -rw-r--r-- | zenstore/gc.cpp | 12 | ||||
| -rw-r--r-- | zenstore/include/zenstore/gc.h | 84 |
3 files changed, 57 insertions, 43 deletions
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp index 6e2559f1f..74c5c2101 100644 --- a/zenserver/diag/logging.cpp +++ b/zenserver/diag/logging.cpp @@ -272,12 +272,12 @@ InitializeLogging(const ZenServerOptions& GlobalOptions) auto HttpLogger = std::make_shared<spdlog::logger>("http_requests", HttpSink); spdlog::register_logger(HttpLogger); - // Jupiter - only log HTTP traffic to file + // Jupiter - only log upstream HTTP traffic to file auto JupiterLogger = std::make_shared<spdlog::logger>("jupiter", FileSink); spdlog::register_logger(JupiterLogger); - // Zen - only log HTTP traffic to file + // Zen - only log upstream HTTP traffic to file auto ZenClientLogger = std::make_shared<spdlog::logger>("zenclient", FileSink); spdlog::register_logger(ZenClientLogger); 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 |