aboutsummaryrefslogtreecommitdiff
path: root/zenstore/include
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 /zenstore/include
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 'zenstore/include')
-rw-r--r--zenstore/include/zenstore/blockstore.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/zenstore/include/zenstore/blockstore.h b/zenstore/include/zenstore/blockstore.h
index 9f16063a0..5ef2d4694 100644
--- a/zenstore/include/zenstore/blockstore.h
+++ b/zenstore/include/zenstore/blockstore.h
@@ -96,7 +96,6 @@ struct BlockStoreFile : public RefCounted
IoBuffer GetChunk(uint64_t Offset, uint64_t Size);
void Read(void* Data, uint64_t Size, uint64_t FileOffset);
void Write(const void* Data, uint64_t Size, uint64_t FileOffset);
- void Truncate(uint64_t Size);
void Flush();
BasicFile& GetBasicFile();
void StreamByteRange(uint64_t FileOffset, uint64_t Size, std::function<void(const void* Data, uint64_t Size)>&& ChunkFun);
@@ -153,6 +152,8 @@ public:
static const char* GetBlockFileExtension();
static std::filesystem::path GetBlockPath(const std::filesystem::path& BlocksBasePath, const uint32_t BlockIndex);
+ inline uint64_t TotalSize() const { return m_TotalSize.load(std::memory_order::relaxed); }
+
private:
std::unordered_map<uint32_t, Ref<BlockStoreFile>> m_ChunkBlocks;
@@ -165,6 +166,8 @@ private:
uint64_t m_MaxBlockSize = 1u << 28;
uint64_t m_MaxBlockCount = BlockStoreDiskLocation::MaxBlockIndex + 1;
std::filesystem::path m_BlocksBasePath;
+
+ std::atomic_uint64_t m_TotalSize{};
};
void blockstore_forcelink();