aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-10-21 15:40:13 +0200
committerGitHub Enterprise <[email protected]>2024-10-21 15:40:13 +0200
commitefd016d84d0940bf616e3efef135532cbf5fedef (patch)
tree50bf249799b65af4a30c473c53bfa8b243be335e /src/zenstore/cache/structuredcachestore.cpp
parent5.5.9-pre8 (diff)
downloadzen-efd016d84d0940bf616e3efef135532cbf5fedef.tar.xz
zen-efd016d84d0940bf616e3efef135532cbf5fedef.zip
bucket size queries (#203)
- Feature: Added options --bucketsize and --bucketsizes to zen cache-info to get data sizes in cache buckets and attachments
Diffstat (limited to 'src/zenstore/cache/structuredcachestore.cpp')
-rw-r--r--src/zenstore/cache/structuredcachestore.cpp24
1 files changed, 23 insertions, 1 deletions
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;