aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.h
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-11-24 13:20:59 +0100
committerGitHub <[email protected]>2022-11-24 04:20:59 -0800
commit666a543ed82896c972526ef08476a41ccbfbd2c4 (patch)
tree49a52941d9ced665431ebf320d0f7d0f4b6e5cfa /zenserver/cache/structuredcachestore.h
parentDon't resize block store block file to max size at creation (#193) (diff)
downloadzen-666a543ed82896c972526ef08476a41ccbfbd2c4.tar.xz
zen-666a543ed82896c972526ef08476a41ccbfbd2c4.zip
Fix disk usage stats (#194)
* Improve tracking of used disk space for filecas and compactcas Add tracking of used disk space for project store Remove ZenCacheStore as GcStorage/GcContributor - underlying ZenCacheNamespace instances register themselves directly - removing this also fixes double reporting of GcStorageSize for namespaces * changelog
Diffstat (limited to 'zenserver/cache/structuredcachestore.h')
-rw-r--r--zenserver/cache/structuredcachestore.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/zenserver/cache/structuredcachestore.h b/zenserver/cache/structuredcachestore.h
index ae1fdf3d3..d5cb536e5 100644
--- a/zenserver/cache/structuredcachestore.h
+++ b/zenserver/cache/structuredcachestore.h
@@ -245,7 +245,7 @@ private:
void CollectGarbage(GcContext& GcCtx);
void UpdateAccessTimes(const std::vector<zen::access_tracking::KeyAccessTime>& AccessTimes);
- inline uint64_t TotalSize() const { return m_TotalSize.load(std::memory_order::relaxed); }
+ inline uint64_t TotalSize() const { return m_TotalStandaloneSize.load(std::memory_order::relaxed) + m_BlockStore.TotalSize(); }
private:
const uint64_t MaxBlockSize = 1ull << 30;
@@ -288,7 +288,7 @@ private:
RwLock m_IndexLock;
IndexMap m_Index;
- std::atomic_uint64_t m_TotalSize{};
+ std::atomic_uint64_t m_TotalStandaloneSize{};
void BuildPath(PathBuilderBase& Path, const IoHash& HashKey);
void PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value);
@@ -353,7 +353,7 @@ private:
ZenCacheNamespace& operator=(const ZenCacheNamespace&) = delete;
};
-class ZenCacheStore final : public GcStorage, public GcContributor
+class ZenCacheStore final
{
public:
static constexpr std::string_view DefaultNamespace =
@@ -376,9 +376,7 @@ public:
void Flush();
void Scrub(ScrubContext& Ctx);
- virtual void GatherReferences(GcContext& GcCtx) override;
- virtual void CollectGarbage(GcContext& GcCtx) override;
- virtual GcStorageSize StorageSize() const override;
+ GcStorageSize StorageSize() const;
private:
ZenCacheNamespace* GetNamespace(std::string_view Namespace);