diff options
| author | Stefan Boberg <[email protected]> | 2025-10-13 13:42:25 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-13 13:42:25 +0200 |
| commit | e5a05c01ba5f1b9517108fe95d54b4066190d66d (patch) | |
| tree | 591d18ecf12753104ee05f868c1155b0a7941e4a /src/zenserver/zenserver.h | |
| parent | refactor builds cmd (#566) (diff) | |
| download | zen-e5a05c01ba5f1b9517108fe95d54b4066190d66d.tar.xz zen-e5a05c01ba5f1b9517108fe95d54b4066190d66d.zip | |
extract storage server into separate source files (#569)
this change moves common base service code into `zenserver.(cpp|h)` and storage server code into `zenstorageserver.(cpp|h)` to more clearly separate concerns but also to make way for another service
Diffstat (limited to 'src/zenserver/zenserver.h')
| -rw-r--r-- | src/zenserver/zenserver.h | 111 |
1 files changed, 21 insertions, 90 deletions
diff --git a/src/zenserver/zenserver.h b/src/zenserver/zenserver.h index 5447158ab..e8ada97ae 100644 --- a/src/zenserver/zenserver.h +++ b/src/zenserver/zenserver.h @@ -2,7 +2,9 @@ #pragma once +#include <zencore/basicfile.h> #include <zenhttp/httpserver.h> +#include <zenhttp/httpstats.h> #include <zenhttp/httpstatus.h> #include <zenutil/zenserverprocess.h> @@ -13,29 +15,8 @@ ZEN_THIRD_PARTY_INCLUDES_START #include <asio.hpp> ZEN_THIRD_PARTY_INCLUDES_END -////////////////////////////////////////////////////////////////////////// -// Services -// - -#include <zenhttp/auth/authmgr.h> -#include <zenhttp/auth/authservice.h> -#include <zenhttp/httpstats.h> -#include <zenhttp/httpstatus.h> -#include <zenhttp/httptest.h> -#include <zenstore/cache/structuredcachestore.h> -#include <zenstore/gc.h> -#include <zenstore/projectstore.h> -#include "admin/admin.h" -#include "buildstore/httpbuildstore.h" -#include "cache/httpstructuredcache.h" #include "diag/diagsvcs.h" -#include "frontend/frontend.h" -#include "objectstore/objectstore.h" -#include "projectstore/httpprojectstore.h" #include "stats/statsreporter.h" -#include "upstream/upstream.h" -#include "vfs/vfsservice.h" -#include "workspaces/httpworkspaces.h" #ifndef ZEN_APP_NAME # define ZEN_APP_NAME "Unreal Zen Storage Server" @@ -43,6 +24,9 @@ ZEN_THIRD_PARTY_INCLUDES_END namespace zen { +struct FLLMTag; +extern const FLLMTag& GetZenserverTag(); + struct ZenStorageServerOptions; class ZenServerBase : public IHttpStatusProvider @@ -122,78 +106,25 @@ protected: virtual void HandleStatusRequest(HttpServerRequest& Request) override; }; -class ZenStorageServer : public ZenServerBase +class ZenServerMain { - ZenStorageServer& operator=(ZenStorageServer&&) = delete; - ZenStorageServer(ZenStorageServer&&) = delete; - public: - ZenStorageServer(); - ~ZenStorageServer(); - - void SetDedicatedMode(bool State) { m_IsDedicatedMode = State; } - void SetTestMode(bool State) { m_TestMode = State; } - void SetDataRoot(std::filesystem::path Root) { m_DataRoot = Root; } - void SetContentRoot(std::filesystem::path Root) { m_ContentRoot = Root; } - - int Initialize(const ZenStorageServerOptions& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry); - void Run(); - void Cleanup(); - -private: - void InitializeState(const ZenStorageServerOptions& ServerOptions); - void InitializeStructuredCache(const ZenStorageServerOptions& ServerOptions); - void Flush(); - - bool m_IsDedicatedMode = false; - bool m_TestMode = false; - bool m_DebugOptionForcedCrash = false; - std::string m_StartupScrubOptions; - CbObject m_RootManifest; - std::filesystem::path m_DataRoot; - std::filesystem::path m_ContentRoot; - asio::steady_timer m_StateMarkerTimer{m_IoContext}; - - void EnqueueStateMarkerTimer(); - void CheckStateMarker(); - - std::unique_ptr<AuthMgr> m_AuthMgr; - std::unique_ptr<HttpAuthService> m_AuthService; - void InitializeAuthentication(const ZenStorageServerOptions& ServerOptions); - - void InitializeServices(const ZenStorageServerOptions& ServerOptions); - void RegisterServices(); - - HttpStatsService m_StatsService; - std::unique_ptr<JobQueue> m_JobQueue; - GcManager m_GcManager; - GcScheduler m_GcScheduler{m_GcManager}; - std::unique_ptr<CidStore> m_CidStore; - Ref<ZenCacheStore> m_CacheStore; - std::unique_ptr<OpenProcessCache> m_OpenProcessCache; - HttpTestService m_TestService; - std::unique_ptr<CidStore> m_BuildCidStore; - std::unique_ptr<BuildStore> m_BuildStore; - -#if ZEN_WITH_TESTS - HttpTestingService m_TestingService; -#endif + ZenServerMain(ZenServerOptions& ServerOptions); + ~ZenServerMain(); - RefPtr<ProjectStore> m_ProjectStore; - std::unique_ptr<VfsServiceImpl> m_VfsServiceImpl; - std::unique_ptr<HttpProjectService> m_HttpProjectService; - std::unique_ptr<Workspaces> m_Workspaces; - std::unique_ptr<HttpWorkspacesService> m_HttpWorkspacesService; - std::unique_ptr<UpstreamCache> m_UpstreamCache; - std::unique_ptr<HttpUpstreamService> m_UpstreamService; - std::unique_ptr<HttpStructuredCacheService> m_StructuredCacheService; - std::unique_ptr<HttpFrontendService> m_FrontendService; - std::unique_ptr<HttpObjectStoreService> m_ObjStoreService; - std::unique_ptr<HttpBuildStoreService> m_BuildStoreService; - std::unique_ptr<VfsService> m_VfsService; - std::unique_ptr<HttpAdminService> m_AdminService; -}; + int Run(); + + ZenServerMain(const ZenServerMain&) = delete; + ZenServerMain& operator=(const ZenServerMain&) = delete; + +protected: + ZenServerOptions& m_ServerOptions; + LockFile m_LockFile; + + virtual void DoRun(ZenServerState::ZenServerEntry* Entry) = 0; -void zenserver_forcelinktests(); + void NotifyReady(); + CbObject MakeLockData(bool IsReady); +}; } // namespace zen |