diff options
| author | Zousar Shaker <[email protected]> | 2025-04-04 07:55:47 -0600 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-04-04 07:55:47 -0600 |
| commit | 7a856464af0478d956a22c6ad466d03c384765d9 (patch) | |
| tree | cc26ee4ed307c08b2e7e0ecf98a3cfddfb4cceb5 /src/zenserver | |
| parent | Alternate fix by explicitly initializing pkg_id (diff) | |
| parent | 5.6.3-pre1 (diff) | |
| download | zen-7a856464af0478d956a22c6ad466d03c384765d9.tar.xz zen-7a856464af0478d956a22c6ad466d03c384765d9.zip | |
Merge branch 'main' into zs/web-ui-blank-import-name-fix
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/buildstore/httpbuildstore.cpp | 34 | ||||
| -rw-r--r-- | src/zenserver/config.cpp | 7 | ||||
| -rw-r--r-- | src/zenserver/config.h | 3 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 7 |
4 files changed, 47 insertions, 4 deletions
diff --git a/src/zenserver/buildstore/httpbuildstore.cpp b/src/zenserver/buildstore/httpbuildstore.cpp index c918f5683..75a333687 100644 --- a/src/zenserver/buildstore/httpbuildstore.cpp +++ b/src/zenserver/buildstore/httpbuildstore.cpp @@ -524,6 +524,40 @@ HttpBuildStoreService::HandleStatsRequest(HttpServerRequest& Request) } Cbo.EndObject(); + Cbo.BeginObject("size"); + { + BuildStore::StorageStats StorageStats = m_BuildStore.GetStorageStats(); + + Cbo << "count" << StorageStats.EntryCount; + Cbo << "bytes" << StorageStats.LargeBlobBytes + StorageStats.SmallBlobBytes + StorageStats.MetadataByteCount; + Cbo.BeginObject("blobs"); + { + Cbo << "count" << (StorageStats.LargeBlobCount + StorageStats.SmallBlobCount); + Cbo << "bytes" << (StorageStats.LargeBlobBytes + StorageStats.SmallBlobBytes); + Cbo.BeginObject("large"); + { + Cbo << "count" << StorageStats.LargeBlobCount; + Cbo << "bytes" << StorageStats.LargeBlobBytes; + } + Cbo.EndObject(); // large + Cbo.BeginObject("small"); + { + Cbo << "count" << StorageStats.SmallBlobCount; + Cbo << "bytes" << StorageStats.SmallBlobBytes; + } + Cbo.EndObject(); // small + } + Cbo.EndObject(); // blobs + + Cbo.BeginObject("metadata"); + { + Cbo << "count" << StorageStats.MetadataCount; + Cbo << "bytes" << StorageStats.MetadataByteCount; + } + Cbo.EndObject(); // metadata + } + Cbo.EndObject(); // size + return Request.WriteResponse(HttpResponseCode::OK, Cbo.Save()); } diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index 52f539dcd..31c104110 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -379,6 +379,7 @@ ParseConfigFile(const std::filesystem::path& Path, ////// buildsstore LuaOptions.AddOption("server.buildstore.enabled"sv, ServerOptions.BuildStoreConfig.Enabled, "buildstore-enabled"sv); + LuaOptions.AddOption("buildstore.disksizelimit"sv, ServerOptions.BuildStoreConfig.MaxDiskSpaceLimit, "buildstore-disksizelimit"); ////// network LuaOptions.AddOption("network.httpserverclass"sv, ServerOptions.HttpServerConfig.ServerClass, "http"sv); @@ -1050,6 +1051,12 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) "Whether the builds store is enabled or not.", cxxopts::value<bool>(ServerOptions.BuildStoreConfig.Enabled)->default_value("false"), ""); + options.add_option("buildstore", + "", + "buildstore-disksizelimit", + "Max number of bytes before build store entries get evicted. Default set to 1099511627776 (1TB week)", + cxxopts::value<uint64_t>(ServerOptions.BuildStoreConfig.MaxDiskSpaceLimit)->default_value("1099511627776"), + ""); options.add_option("stats", "", diff --git a/src/zenserver/config.h b/src/zenserver/config.h index a87b6f8b3..6bd7aa357 100644 --- a/src/zenserver/config.h +++ b/src/zenserver/config.h @@ -138,7 +138,8 @@ struct ZenProjectStoreConfig struct ZenBuildStoreConfig { - bool Enabled = false; + bool Enabled = false; + uint64_t MaxDiskSpaceLimit = 1u * 1024u * 1024u * 1024u * 1024u; // 1TB }; struct ZenWorkspacesConfig diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index c7cb2ba6e..3f2f01d5a 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -266,9 +266,10 @@ ZenServer::Initialize(const ZenServerOptions& ServerOptions, ZenServerState::Zen if (ServerOptions.BuildStoreConfig.Enabled) { - BuildStoreConfig ObjCfg; - ObjCfg.RootDirectory = m_DataRoot / "builds"; - m_BuildStore = std::make_unique<BuildStore>(std::move(ObjCfg), m_GcManager); + BuildStoreConfig BuildsCfg; + BuildsCfg.RootDirectory = m_DataRoot / "builds"; + BuildsCfg.MaxDiskSpaceLimit = ServerOptions.BuildStoreConfig.MaxDiskSpaceLimit; + m_BuildStore = std::make_unique<BuildStore>(std::move(BuildsCfg), m_GcManager); } if (ServerOptions.StructuredCacheConfig.Enabled) |