aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/admin
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-08-20 12:33:03 +0200
committerGitHub Enterprise <[email protected]>2025-08-20 12:33:03 +0200
commit4c05d1041461b630cd5770dae5e8d03147d5674b (patch)
tree3f5d6b1b4b2b3f167f94e98f902a5f60c2e3d753 /src/zenserver/admin
parentzen print fixes/improvements (#469) (diff)
downloadzen-4c05d1041461b630cd5770dae5e8d03147d5674b.tar.xz
zen-4c05d1041461b630cd5770dae5e8d03147d5674b.zip
per namespace/project cas prep refactor (#470)
- Refactor so we can have more than one cas store for project store and cache. - Refactor `UpstreamCacheClient` so it is not tied to a specific CidStore - Refactor scrub to keep the GC interface ScrubStorage function separate from scrub accessor functions (renamed to Scrub). - Refactor storage size to keep GC interface StorageSize function separate from size accessor functions (renamed to TotalSize) - Refactor cache storage so `ZenCacheDiskLayer::CacheBucket` implements GcStorage interface rather than `ZenCacheNamespace`
Diffstat (limited to 'src/zenserver/admin')
-rw-r--r--src/zenserver/admin/admin.cpp28
-rw-r--r--src/zenserver/admin/admin.h12
2 files changed, 6 insertions, 34 deletions
diff --git a/src/zenserver/admin/admin.cpp b/src/zenserver/admin/admin.cpp
index 9d982678a..8c2e6d771 100644
--- a/src/zenserver/admin/admin.cpp
+++ b/src/zenserver/admin/admin.cpp
@@ -17,14 +17,11 @@
# include <mimalloc.h>
#endif
-#include <zenstore/cidstore.h>
#include <zenstore/gc.h>
-#include <zenstore/buildstore/buildstore.h>
#include <zenstore/cache/structuredcachestore.h>
#include <zenutil/workerpools.h>
#include "config.h"
-#include "projectstore/projectstore.h"
#include <chrono>
@@ -104,17 +101,13 @@ GetStatsForStateDirectory(std::filesystem::path StateDir)
HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
JobQueue& BackgroundJobQueue,
ZenCacheStore* CacheStore,
- CidStore* CidStore,
- ProjectStore* ProjectStore,
- BuildStore* BuildStore,
+ std::function<void()>&& FlushFunction,
const LogPaths& LogPaths,
const ZenServerOptions& ServerOptions)
: m_GcScheduler(Scheduler)
, m_BackgroundJobQueue(BackgroundJobQueue)
, m_CacheStore(CacheStore)
-, m_CidStore(CidStore)
-, m_ProjectStore(ProjectStore)
-, m_BuildStore(BuildStore)
+, m_FlushFunction(std::move(FlushFunction))
, m_LogPaths(LogPaths)
, m_ServerOptions(ServerOptions)
{
@@ -783,22 +776,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
"flush",
[this](HttpRouterRequest& Req) {
HttpServerRequest& HttpReq = Req.ServerRequest();
- if (m_CidStore)
- {
- m_CidStore->Flush();
- }
- if (m_CacheStore)
- {
- m_CacheStore->Flush();
- }
- if (m_ProjectStore)
- {
- m_ProjectStore->Flush();
- }
- if (m_BuildStore)
- {
- m_BuildStore->Flush();
- }
+ m_FlushFunction();
HttpReq.WriteResponse(HttpResponseCode::OK);
},
HttpVerb::kPost);
diff --git a/src/zenserver/admin/admin.h b/src/zenserver/admin/admin.h
index e7821dead..9a49f5120 100644
--- a/src/zenserver/admin/admin.h
+++ b/src/zenserver/admin/admin.h
@@ -4,15 +4,13 @@
#include <zencore/compactbinary.h>
#include <zenhttp/httpserver.h>
+#include <functional>
namespace zen {
class GcScheduler;
class JobQueue;
class ZenCacheStore;
-class CidStore;
-class ProjectStore;
-class BuildStore;
struct ZenServerOptions;
class HttpAdminService : public zen::HttpService
@@ -27,9 +25,7 @@ public:
HttpAdminService(GcScheduler& Scheduler,
JobQueue& BackgroundJobQueue,
ZenCacheStore* CacheStore,
- CidStore* CidStore,
- ProjectStore* ProjectStore,
- BuildStore* BuildStore,
+ std::function<void()>&& FlushFunction,
const LogPaths& LogPaths,
const ZenServerOptions& ServerOptions);
~HttpAdminService();
@@ -42,9 +38,7 @@ private:
GcScheduler& m_GcScheduler;
JobQueue& m_BackgroundJobQueue;
ZenCacheStore* m_CacheStore;
- CidStore* m_CidStore;
- ProjectStore* m_ProjectStore;
- BuildStore* m_BuildStore;
+ std::function<void()> m_FlushFunction;
LogPaths m_LogPaths;
const ZenServerOptions& m_ServerOptions;
};