aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-08-20 12:33:03 +0200
committerGitHub Enterprise <[email protected]>2025-08-20 12:33:03 +0200
commit4c05d1041461b630cd5770dae5e8d03147d5674b (patch)
tree3f5d6b1b4b2b3f167f94e98f902a5f60c2e3d753 /src/zenstore/cas.cpp
parentzen print fixes/improvements (#469) (diff)
downloadzen-4c05d1041461b630cd5770dae5e8d03147d5674b.tar.xz
zen-4c05d1041461b630cd5770dae5e8d03147d5674b.zip
per namespace/project cas prep refactor (#470)
- Refactor so we can have more than one cas store for project store and cache. - Refactor `UpstreamCacheClient` so it is not tied to a specific CidStore - Refactor scrub to keep the GC interface ScrubStorage function separate from scrub accessor functions (renamed to Scrub). - Refactor storage size to keep GC interface StorageSize function separate from size accessor functions (renamed to TotalSize) - Refactor cache storage so `ZenCacheDiskLayer::CacheBucket` implements GcStorage interface rather than `ZenCacheNamespace`
Diffstat (limited to 'src/zenstore/cas.cpp')
-rw-r--r--src/zenstore/cas.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp
index 5879a6742..6b89beb3d 100644
--- a/src/zenstore/cas.cpp
+++ b/src/zenstore/cas.cpp
@@ -73,9 +73,12 @@ public:
WorkerThreadPool* OptionalWorkerPool,
uint64_t LargeSizeLimit) override;
virtual void Flush() override;
- virtual void ScrubStorage(ScrubContext& Ctx) override;
virtual CidStoreSize TotalSize() const override;
+#if ZEN_WITH_TESTS
+ virtual void Scrub(ScrubContext& Ctx) override;
+#endif // ZEN_WITH_TESTS
+
private:
CasContainerStrategy m_TinyStrategy;
CasContainerStrategy m_SmallStrategy;
@@ -463,24 +466,19 @@ CasImpl::Flush()
m_LargeStrategy.Flush();
}
+#if ZEN_WITH_TESTS
void
-CasImpl::ScrubStorage(ScrubContext& Ctx)
+CasImpl::Scrub(ScrubContext& Ctx)
{
ZEN_MEMSCOPE(GetCasTag());
ZEN_TRACE_CPU("Cas::ScrubStorage");
- if (m_LastScrubTime == Ctx.ScrubTimestamp())
- {
- return;
- }
-
- m_LastScrubTime = Ctx.ScrubTimestamp();
-
m_SmallStrategy.ScrubStorage(Ctx);
m_TinyStrategy.ScrubStorage(Ctx);
m_LargeStrategy.ScrubStorage(Ctx);
}
+#endif // ZEN_WITH_TESTS
CidStoreSize
CasImpl::TotalSize() const
@@ -523,7 +521,7 @@ TEST_CASE("CasStore")
WorkerThreadPool ThreadPool{1};
ScrubContext Ctx{ThreadPool};
- Store->ScrubStorage(Ctx);
+ Store->Scrub(Ctx);
IoBuffer Value1{16};
memcpy(Value1.MutableData(), "1234567890123456", 16);