From efd016d84d0940bf616e3efef135532cbf5fedef Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 21 Oct 2024 15:40:13 +0200 Subject: bucket size queries (#203) - Feature: Added options --bucketsize and --bucketsizes to zen cache-info to get data sizes in cache buckets and attachments --- src/zenstore/cache/structuredcachestore.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/zenstore/cache/structuredcachestore.cpp') diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp index d30bd93cc..578929198 100644 --- a/src/zenstore/cache/structuredcachestore.cpp +++ b/src/zenstore/cache/structuredcachestore.cpp @@ -370,6 +370,12 @@ ZenCacheNamespace::DisableUpdateCapture() m_DiskLayer.DisableUpdateCapture(); } +bool +ZenCacheNamespace::GetContentStats(std::string_view BucketName, CacheContentStats& OutContentStats) const +{ + return m_DiskLayer.GetContentStats(BucketName, OutContentStats); +} + #if ZEN_WITH_TESTS void ZenCacheNamespace::SetAccessTime(std::string_view Bucket, const IoHash& HashKey, GcClock::TimePoint Time) @@ -1080,6 +1086,16 @@ ZenCacheStore::GetCapturedNamespaces() return {}; } +bool +ZenCacheStore::GetContentStats(std::string_view NamespaceName, std::string_view BucketName, CacheContentStats& OutContentStats) const +{ + if (const ZenCacheNamespace* Namespace = FindNamespace(NamespaceName); Namespace) + { + return Namespace->GetContentStats(BucketName, OutContentStats); + } + return false; +} + std::string ZenCacheStore::GetGcName(GcCtx&) { @@ -1161,7 +1177,13 @@ public: for (ZenCacheDiskLayer::CacheBucket* Bucket : AddedBuckets) { - bool Continue = Bucket->GetReferences(Ctx, /*StateIsAlreadyLocked*/ true, m_References); + bool Continue = Bucket->GetReferences(Ctx.Logger, + Ctx.IsCancelledFlag, + /*StateIsAlreadyLocked*/ true, + Ctx.Settings.StoreCacheAttachmentMetaData, + Ctx.Settings.StoreCacheAttachmentMetaData, + m_References, + nullptr); if (!Continue) { break; -- cgit v1.2.3