aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-05-16 12:23:42 +0200
committerGitHub <[email protected]>2023-05-16 12:23:42 +0200
commita4ff07d68eeae66c008bfac28cb87c94a92cf257 (patch)
tree630940f228c35d29fac31ced2ba7f9fd16fca1c8 /src/zenstore/include
parentAdded CHANGELOG.md descriptions for recent changes (diff)
downloadzen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.tar.xz
zen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.zip
Add `--gc-projectstore-duration-seconds` option (#281)
* Add `--gc-projectstore-duration-seconds` option * Cleanup lua gc options parsing * Remove dead configuration values * changelog
Diffstat (limited to 'src/zenstore/include')
-rw-r--r--src/zenstore/include/zenstore/gc.h18
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(); }