diff options
| author | Dan Engelbrecht <[email protected]> | 2025-04-04 13:07:42 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-04-04 13:07:42 +0200 |
| commit | 6d22f7e086646dcfb0d7f5e2c784acba53235c35 (patch) | |
| tree | 16e6865915f1998e54b4d3b2bfaa9bbcf4873456 /src/zenstore/include | |
| parent | Zs/mac restore minver 12.5 (#344) (diff) | |
| download | zen-6d22f7e086646dcfb0d7f5e2c784acba53235c35.tar.xz zen-6d22f7e086646dcfb0d7f5e2c784acba53235c35.zip | |
blobstore size limit (#342)
- Feature: zenserver option `--buildstore-disksizelimit` to set an soft upper limit for build storage data. Defaults to 1TB.
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/buildstore/buildstore.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/zenstore/include/zenstore/buildstore/buildstore.h b/src/zenstore/include/zenstore/buildstore/buildstore.h index d88e682de..adf48dc26 100644 --- a/src/zenstore/include/zenstore/buildstore/buildstore.h +++ b/src/zenstore/include/zenstore/buildstore/buildstore.h @@ -24,9 +24,10 @@ struct BuildStoreConfig uint32_t SmallBlobBlockStoreAlignement = 16; uint32_t MetadataBlockStoreMaxBlockSize = 64 * 1024 * 1024; uint32_t MetadataBlockStoreAlignement = 8; + uint64_t MaxDiskSpaceLimit = 1u * 1024u * 1024u * 1024u * 1024u; // 1TB }; -class BuildStore : public GcReferencer, public GcReferenceLocker //, public GcStorage +class BuildStore : public GcReferencer, public GcReferenceLocker, public GcStorage { public: explicit BuildStore(const BuildStoreConfig& Config, GcManager& Gc); @@ -48,10 +49,24 @@ public: void Flush(); + struct StorageStats + { + uint64_t EntryCount = 0; + uint64_t LargeBlobCount = 0; + uint64_t LargeBlobBytes = 0; + uint64_t SmallBlobCount = 0; + uint64_t SmallBlobBytes = 0; + uint64_t MetadataCount = 0; + uint64_t MetadataByteCount = 0; + }; + + StorageStats GetStorageStats() const; + #if ZEN_WITH_TESTS std::optional<AccessTime> GetLastAccessTime(const IoHash& Key) const; bool SetLastAccessTime(const IoHash& Key, const AccessTime& Time); #endif // ZEN_WITH_TESTS + private: LoggerRef Log() { return m_Log; } @@ -71,6 +86,10 @@ private: //////// GcReferenceLocker virtual std::vector<RwLock::SharedLockScope> LockState(GcCtx& Ctx) override; + //////// GcStorage + virtual void ScrubStorage(ScrubContext& ScrubCtx) override; + virtual GcStorageSize StorageSize() const override; + #pragma pack(push) #pragma pack(1) struct PayloadEntry |