diff options
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/gc.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/zenstore/include/zenstore/gc.h b/src/zenstore/include/zenstore/gc.h index 4c709b8a2..881936d0f 100644 --- a/src/zenstore/include/zenstore/gc.h +++ b/src/zenstore/include/zenstore/gc.h @@ -48,7 +48,7 @@ public: class GcContext { public: - GcContext(const GcClock::TimePoint& ExpireTime); + GcContext(const GcClock::TimePoint& CacheExpireTime, const GcClock::TimePoint& ProjectStoreExpireTime); ~GcContext(); void AddRetainedCids(std::span<const IoHash> Cid); @@ -70,7 +70,8 @@ public: bool CollectSmallObjects() const; void CollectSmallObjects(bool NewState); - GcClock::TimePoint ExpireTime() const; + GcClock::TimePoint CacheExpireTime() const; + GcClock::TimePoint ProjectStoreExpireTime() const; void DiskReservePath(const std::filesystem::path& Path); uint64_t ClaimGCReserve(); @@ -174,6 +175,7 @@ struct GcSchedulerConfig std::chrono::seconds MonitorInterval{30}; std::chrono::seconds Interval{}; std::chrono::seconds MaxCacheDuration{86400}; + std::chrono::seconds MaxProjectStoreDuration{604800}; bool CollectSmallObjects = true; bool Enabled = true; uint64_t DiskReserveSize = 1ul << 28; @@ -216,16 +218,20 @@ public: struct TriggerGcParams { - bool CollectSmallObjects = false; - std::chrono::seconds MaxCacheDuration = std::chrono::seconds::max(); - uint64_t DiskSizeSoftLimit = 0; + bool CollectSmallObjects = false; + std::chrono::seconds MaxCacheDuration = std::chrono::seconds::max(); + std::chrono::seconds MaxProjectStoreDuration = std::chrono::seconds::max(); + uint64_t DiskSizeSoftLimit = 0; }; bool TriggerGc(const TriggerGcParams& Params); private: void SchedulerThread(); - void CollectGarbage(const GcClock::TimePoint& ExpireTime, bool Delete, bool CollectSmallObjects); + void CollectGarbage(const GcClock::TimePoint& CacheExpireTime, + const GcClock::TimePoint& ProjectStoreExpireTime, + bool Delete, + bool CollectSmallObjects); GcClock::TimePoint NextGcTime(GcClock::TimePoint CurrentTime); spdlog::logger& Log() { return m_Log; } virtual bool AreDiskWritesAllowed() const override { return !m_AreDiskWritesBlocked.load(); } |