aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-15 20:54:46 +0200
committerStefan Boberg <[email protected]>2023-05-15 20:54:46 +0200
commit583b308a1e605da9bd70484767d6134891b9c3ba (patch)
tree5769264a7f637823c39e62cd61a2b44316102d5a /src/zenstore
parentsome HttpClient changes eliminating some cpr helpers (diff)
downloadzen-583b308a1e605da9bd70484767d6134891b9c3ba.tar.xz
zen-583b308a1e605da9bd70484767d6134891b9c3ba.zip
minor GC API cleanup
Scrub -> ScrubStorage Trigger -> TriggerGc (to make relationship to TriggerScrub clearer)
Diffstat (limited to 'src/zenstore')
-rw-r--r--src/zenstore/cas.cpp12
-rw-r--r--src/zenstore/cas.h2
-rw-r--r--src/zenstore/cidstore.cpp8
-rw-r--r--src/zenstore/compactcas.cpp2
-rw-r--r--src/zenstore/compactcas.h2
-rw-r--r--src/zenstore/filecas.cpp2
-rw-r--r--src/zenstore/filecas.h2
-rw-r--r--src/zenstore/gc.cpp10
-rw-r--r--src/zenstore/include/zenstore/cidstore.h2
-rw-r--r--src/zenstore/include/zenstore/gc.h28
10 files changed, 35 insertions, 35 deletions
diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp
index fdec78c60..33e1ae0e0 100644
--- a/src/zenstore/cas.cpp
+++ b/src/zenstore/cas.cpp
@@ -52,7 +52,7 @@ public:
virtual bool ContainsChunk(const IoHash& ChunkHash) override;
virtual void FilterChunks(HashKeySet& InOutChunks) override;
virtual void Flush() override;
- virtual void Scrub(ScrubContext& Ctx) override;
+ virtual void ScrubStorage(ScrubContext& Ctx) override;
virtual void GarbageCollect(GcContext& GcCtx) override;
virtual CidStoreSize TotalSize() const override;
@@ -258,7 +258,7 @@ CasImpl::Flush()
}
void
-CasImpl::Scrub(ScrubContext& Ctx)
+CasImpl::ScrubStorage(ScrubContext& Ctx)
{
if (m_LastScrubTime == Ctx.ScrubTimestamp())
{
@@ -267,9 +267,9 @@ CasImpl::Scrub(ScrubContext& Ctx)
m_LastScrubTime = Ctx.ScrubTimestamp();
- m_SmallStrategy.Scrub(Ctx);
- m_TinyStrategy.Scrub(Ctx);
- m_LargeStrategy.Scrub(Ctx);
+ m_SmallStrategy.ScrubStorage(Ctx);
+ m_TinyStrategy.ScrubStorage(Ctx);
+ m_LargeStrategy.ScrubStorage(Ctx);
}
void
@@ -318,7 +318,7 @@ TEST_CASE("CasStore")
Store->Initialize(config);
ScrubContext Ctx;
- Store->Scrub(Ctx);
+ Store->ScrubStorage(Ctx);
IoBuffer Value1{16};
memcpy(Value1.MutableData(), "1234567890123456", 16);
diff --git a/src/zenstore/cas.h b/src/zenstore/cas.h
index 9c48d4707..e79dea6c9 100644
--- a/src/zenstore/cas.h
+++ b/src/zenstore/cas.h
@@ -51,7 +51,7 @@ public:
virtual bool ContainsChunk(const IoHash& ChunkHash) = 0;
virtual void FilterChunks(HashKeySet& InOutChunks) = 0;
virtual void Flush() = 0;
- virtual void Scrub(ScrubContext& Ctx) = 0;
+ virtual void ScrubStorage(ScrubContext& Ctx) = 0;
virtual void GarbageCollect(GcContext& GcCtx) = 0;
virtual CidStoreSize TotalSize() const = 0;
diff --git a/src/zenstore/cidstore.cpp b/src/zenstore/cidstore.cpp
index 5a5116faf..8d4679128 100644
--- a/src/zenstore/cidstore.cpp
+++ b/src/zenstore/cidstore.cpp
@@ -49,7 +49,7 @@ struct CidStore::Impl
void Flush() { m_CasStore.Flush(); }
- void Scrub(ScrubContext& Ctx)
+ void ScrubStorage(ScrubContext& Ctx)
{
if (Ctx.ScrubTimestamp() == m_LastScrubTime)
{
@@ -58,7 +58,7 @@ struct CidStore::Impl
m_LastScrubTime = Ctx.ScrubTimestamp();
- m_CasStore.Scrub(Ctx);
+ m_CasStore.ScrubStorage(Ctx);
}
uint64_t m_LastScrubTime = 0;
@@ -111,9 +111,9 @@ CidStore::Flush()
}
void
-CidStore::Scrub(ScrubContext& Ctx)
+CidStore::ScrubStorage(ScrubContext& Ctx)
{
- m_Impl->Scrub(Ctx);
+ m_Impl->ScrubStorage(Ctx);
}
CidStoreSize
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index c513aa132..47c31eb5a 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -233,7 +233,7 @@ CasContainerStrategy::Flush()
}
void
-CasContainerStrategy::Scrub(ScrubContext& Ctx)
+CasContainerStrategy::ScrubStorage(ScrubContext& Ctx)
{
std::vector<IoHash> BadKeys;
uint64_t ChunkCount{0}, ChunkBytes{0};
diff --git a/src/zenstore/compactcas.h b/src/zenstore/compactcas.h
index a043e62c1..eebe3e7d2 100644
--- a/src/zenstore/compactcas.h
+++ b/src/zenstore/compactcas.h
@@ -61,7 +61,7 @@ struct CasContainerStrategy final : public GcStorage
uint64_t Alignment,
bool IsNewStore);
void Flush();
- void Scrub(ScrubContext& Ctx);
+ void ScrubStorage(ScrubContext& Ctx);
virtual void CollectGarbage(GcContext& GcCtx) override;
virtual GcStorageSize StorageSize() const override { return {.DiskSize = m_BlockStore.TotalSize()}; }
diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp
index 4474b52bd..30c6c2d4d 100644
--- a/src/zenstore/filecas.cpp
+++ b/src/zenstore/filecas.cpp
@@ -832,7 +832,7 @@ FileCasStrategy::Flush()
}
void
-FileCasStrategy::Scrub(ScrubContext& Ctx)
+FileCasStrategy::ScrubStorage(ScrubContext& Ctx)
{
ZEN_ASSERT(m_IsInitialized);
diff --git a/src/zenstore/filecas.h b/src/zenstore/filecas.h
index 01d3648da..5dbf820e5 100644
--- a/src/zenstore/filecas.h
+++ b/src/zenstore/filecas.h
@@ -40,7 +40,7 @@ struct FileCasStrategy final : public GcStorage
bool HaveChunk(const IoHash& ChunkHash);
void FilterChunks(HashKeySet& InOutChunks);
void Flush();
- void Scrub(ScrubContext& Ctx);
+ void ScrubStorage(ScrubContext& Ctx);
virtual void CollectGarbage(GcContext& GcCtx) override;
virtual GcStorageSize StorageSize() const override { return {.DiskSize = m_TotalSize.load(std::memory_order::relaxed)}; }
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp
index 503470bb0..9cbc43b1b 100644
--- a/src/zenstore/gc.cpp
+++ b/src/zenstore/gc.cpp
@@ -657,14 +657,14 @@ GcScheduler::Shutdown()
}
bool
-GcScheduler::Trigger(const GcScheduler::TriggerParams& Params)
+GcScheduler::TriggerGc(const GcScheduler::TriggerGcParams& Params)
{
if (m_Config.Enabled)
{
std::unique_lock Lock(m_GcMutex);
if (static_cast<uint32_t>(GcSchedulerStatus::kIdle) == m_Status)
{
- m_TriggerParams = Params;
+ m_TriggerGcParams = Params;
uint32_t IdleState = static_cast<uint32_t>(GcSchedulerStatus::kIdle);
if (m_Status.compare_exchange_strong(IdleState, static_cast<uint32_t>(GcSchedulerStatus::kRunning)))
{
@@ -735,10 +735,10 @@ GcScheduler::SchedulerThread()
std::chrono::seconds MaxCacheDuration = m_Config.MaxCacheDuration;
uint64_t DiskSizeSoftLimit = m_Config.DiskSizeSoftLimit;
GcClock::TimePoint Now = GcClock::Now();
- if (m_TriggerParams)
+ if (m_TriggerGcParams)
{
- const auto TriggerParams = m_TriggerParams.value();
- m_TriggerParams.reset();
+ const auto TriggerParams = m_TriggerGcParams.value();
+ m_TriggerGcParams.reset();
CollectSmallObjects = TriggerParams.CollectSmallObjects;
if (TriggerParams.MaxCacheDuration != std::chrono::seconds::max())
diff --git a/src/zenstore/include/zenstore/cidstore.h b/src/zenstore/include/zenstore/cidstore.h
index 16ca78225..ecc7faab0 100644
--- a/src/zenstore/include/zenstore/cidstore.h
+++ b/src/zenstore/include/zenstore/cidstore.h
@@ -75,7 +75,7 @@ public:
bool ContainsChunk(const IoHash& DecompressedId);
void FilterChunks(HashKeySet& InOutChunks);
void Flush();
- void Scrub(ScrubContext& Ctx);
+ void ScrubStorage(ScrubContext& Ctx);
CidStoreSize TotalSize() const;
private:
diff --git a/src/zenstore/include/zenstore/gc.h b/src/zenstore/include/zenstore/gc.h
index fe9857e6a..0e18315d9 100644
--- a/src/zenstore/include/zenstore/gc.h
+++ b/src/zenstore/include/zenstore/gc.h
@@ -220,14 +220,14 @@ public:
void Shutdown();
GcSchedulerStatus Status() const { return static_cast<GcSchedulerStatus>(m_Status.load()); }
- struct TriggerParams
+ struct TriggerGcParams
{
bool CollectSmallObjects = false;
std::chrono::seconds MaxCacheDuration = std::chrono::seconds::max();
uint64_t DiskSizeSoftLimit = 0;
};
- bool Trigger(const TriggerParams& Params);
+ bool TriggerGc(const TriggerGcParams& Params);
private:
void SchedulerThread();
@@ -237,18 +237,18 @@ private:
virtual bool AreDiskWritesAllowed() const override { return !m_AreDiskWritesBlocked.load(); }
void CheckDiskSpace(const DiskSpace& Space);
- spdlog::logger& m_Log;
- GcManager& m_GcManager;
- GcSchedulerConfig m_Config;
- GcClock::TimePoint m_LastGcTime{};
- GcClock::TimePoint m_LastGcExpireTime{};
- GcClock::TimePoint m_NextGcTime{};
- std::atomic_uint32_t m_Status{};
- std::thread m_GcThread;
- std::mutex m_GcMutex;
- std::condition_variable m_GcSignal;
- std::optional<TriggerParams> m_TriggerParams;
- std::atomic_bool m_AreDiskWritesBlocked = false;
+ spdlog::logger& m_Log;
+ GcManager& m_GcManager;
+ GcSchedulerConfig m_Config;
+ GcClock::TimePoint m_LastGcTime{};
+ GcClock::TimePoint m_LastGcExpireTime{};
+ GcClock::TimePoint m_NextGcTime{};
+ std::atomic_uint32_t m_Status{};
+ std::thread m_GcThread;
+ std::mutex m_GcMutex;
+ std::condition_variable m_GcSignal;
+ std::optional<TriggerGcParams> m_TriggerGcParams;
+ std::atomic_bool m_AreDiskWritesBlocked = false;
TCasLogFile<DiskUsageWindow::DiskUsageEntry> m_DiskUsageLog;
DiskUsageWindow m_DiskUsageWindow;