// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "zenserver.h" #include #include #include #include #include #include #include #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" #if ZEN_WITH_COMPUTE_SERVICES # include #endif namespace zen { class ZenStorageServer : public ZenServerBase { ZenStorageServer& operator=(ZenStorageServer&&) = delete; ZenStorageServer(ZenStorageServer&&) = delete; public: ZenStorageServer(); ~ZenStorageServer(); int Initialize(const ZenStorageServerConfig& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry); void Run(); void Cleanup(); private: void InitializeState(const ZenStorageServerConfig& ServerOptions); void InitializeStructuredCache(const ZenStorageServerConfig& ServerOptions); void Flush(); std::string m_StartupScrubOptions; CbObject m_RootManifest; asio::steady_timer m_StateMarkerTimer{m_IoContext}; void EnqueueStateMarkerTimer(); void CheckStateMarker(); std::unique_ptr m_AuthMgr; std::unique_ptr m_AuthService; void InitializeAuthentication(const ZenStorageServerConfig& ServerOptions); void InitializeServices(const ZenStorageServerConfig& ServerOptions); void RegisterServices(); HttpStatsService m_StatsService; std::unique_ptr m_JobQueue; GcManager m_GcManager; GcScheduler m_GcScheduler{m_GcManager}; std::unique_ptr m_CidStore; Ref m_CacheStore; std::unique_ptr m_OpenProcessCache; HttpTestService m_TestService; std::unique_ptr m_BuildCidStore; std::unique_ptr m_BuildStore; #if ZEN_WITH_TESTS HttpTestingService m_TestingService; #endif RefPtr m_ProjectStore; std::unique_ptr m_VfsServiceImpl; std::unique_ptr m_HttpProjectService; std::unique_ptr m_Workspaces; std::unique_ptr m_HttpWorkspacesService; std::unique_ptr m_UpstreamCache; std::unique_ptr m_UpstreamService; std::unique_ptr m_StructuredCacheService; std::unique_ptr m_FrontendService; std::unique_ptr m_ObjStoreService; std::unique_ptr m_BuildStoreService; std::unique_ptr m_VfsService; std::unique_ptr m_AdminService; std::unique_ptr m_ApiService; #if ZEN_WITH_COMPUTE_SERVICES std::unique_ptr m_HttpFunctionService; #endif }; struct ZenStorageServerConfigurator; class ZenStorageServerMain : public ZenServerMain { public: ZenStorageServerMain(ZenStorageServerConfig& ServerOptions); ~ZenStorageServerMain(); virtual void DoRun(ZenServerState::ZenServerEntry* Entry) override; virtual void InitializeLogging() override; ZenStorageServerMain(const ZenStorageServerMain&) = delete; ZenStorageServerMain& operator=(const ZenStorageServerMain&) = delete; typedef ZenStorageServerConfig Config; typedef ZenStorageServerConfigurator Configurator; private: ZenStorageServerConfig& m_ServerOptions; }; } // namespace zen