diff options
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 9a8090fc0..33cec7db1 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -19,6 +19,9 @@ #include <zenstore/cidstore.h> #include <zenutil/zenserverprocess.h> +#define ZEN_USE_NAMED_PIPES 0 +#define ZEN_USE_EXEC 0 + #if ZEN_USE_MIMALLOC ZEN_THIRD_PARTY_INCLUDES_START # include <mimalloc-new-delete.h> @@ -43,7 +46,7 @@ ZEN_THIRD_PARTY_INCLUDES_END # define BUILD_VERSION ("dev-build") #endif -#define ZEN_SCHEMA_VERSION 1 +#define ZEN_SCHEMA_VERSION 2 /* latest change by: stefan boberg */ ////////////////////////////////////////////////////////////////////////// // We don't have any doctest code in this file but this is needed to bring @@ -217,13 +220,18 @@ public: m_ProjectStore = new zen::ProjectStore(*m_CidStore, m_DataRoot / "projects"); m_HttpProjectService.reset(new zen::HttpProjectService{*m_CidStore, m_ProjectStore}); + +#if ZEN_USE_NAMED_PIPES m_LocalProjectService = zen::LocalProjectService::New(*m_CasStore, m_ProjectStore); +#endif ZEN_INFO("instantiating compute services"); +#if ZEN_USE_EXEC std::filesystem::path SandboxDir = m_DataRoot / "exec" / "sandbox"; zen::CreateDirectories(SandboxDir); m_HttpLaunchService = std::make_unique<zen::HttpLaunchService>(*m_CasStore, SandboxDir); +#endif std::filesystem::path ApplySandboxDir = m_DataRoot / "exec" / "apply"; zen::CreateDirectories(ApplySandboxDir); @@ -265,10 +273,12 @@ public: m_Http->RegisterService(*m_StructuredCacheService); } +#if ZEN_USE_EXEC if (m_HttpLaunchService) { m_Http->RegisterService(*m_HttpLaunchService); } +#endif if (m_HttpFunctionService) { @@ -430,6 +440,16 @@ public: NiceByteRate(Ctx.ScrubbedBytes(), ElapsedTimeMs)); } + void CollectGarbage() + { + Stopwatch Timer; + ZEN_INFO("Garbage collection STARTING"); + + m_Gc.CollectGarbage(); + + ZEN_INFO("Garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); + } + void Flush() { if (m_CasStore) @@ -493,17 +513,15 @@ private: zen::Ref<zen::HttpServer> m_Http; zen::HttpStatusService m_StatusService; zen::HttpStatsService m_StatsService; - std::unique_ptr<zen::CasStore> m_CasStore{zen::CreateCasStore()}; + zen::CasGc m_Gc; + std::unique_ptr<zen::CasStore> m_CasStore{zen::CreateCasStore(m_Gc)}; std::unique_ptr<zen::CidStore> m_CidStore; std::unique_ptr<zen::ZenCacheStore> m_CacheStore; - zen::CasGc m_Gc{*m_CasStore}; zen::CasScrubber m_Scrubber{*m_CasStore}; zen::HttpTestService m_TestService; zen::HttpTestingService m_TestingService; zen::HttpCasService m_CasService{*m_CasStore}; zen::RefPtr<zen::ProjectStore> m_ProjectStore; - zen::Ref<zen::LocalProjectService> m_LocalProjectService; - std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService; std::unique_ptr<zen::HttpProjectService> m_HttpProjectService; std::unique_ptr<zen::HttpStructuredCacheService> m_StructuredCacheService; zen::HttpAdminService m_AdminService; @@ -512,6 +530,14 @@ private: std::unique_ptr<zen::HttpFunctionService> m_HttpFunctionService; std::unique_ptr<zen::HttpFrontendService> m_FrontendService; +#if ZEN_USE_EXEC + std::unique_ptr<zen::HttpLaunchService> m_HttpLaunchService; +#endif + +#if ZEN_USE_NAMED_PIPES + zen::Ref<zen::LocalProjectService> m_LocalProjectService; +#endif + bool m_DebugOptionForcedCrash = false; }; @@ -627,7 +653,7 @@ ZenServer::InitializeStructuredCache(ZenServiceConfig& ServiceConfig) auto ValueOrDefault = [](std::string_view Value, std::string_view Default) { return Value.empty() ? Default : Value; }; ZEN_INFO("instantiating structured cache service"); - m_CacheStore = std::make_unique<ZenCacheStore>(m_DataRoot / "cache"); + m_CacheStore = std::make_unique<ZenCacheStore>(m_Gc, m_DataRoot / "cache"); std::unique_ptr<zen::UpstreamCache> UpstreamCache; if (ServiceConfig.UpstreamCacheConfig.CachePolicy != UpstreamCachePolicy::Disabled) @@ -723,12 +749,8 @@ ZenServer::InitializeStructuredCache(ZenServiceConfig& ServiceConfig) } } - m_StructuredCacheService.reset(new zen::HttpStructuredCacheService(*m_CacheStore, - *m_CasStore, - *m_CidStore, - m_StatsService, - m_StatusService, - std::move(UpstreamCache))); + m_StructuredCacheService.reset( + new zen::HttpStructuredCacheService(*m_CacheStore, *m_CidStore, m_StatsService, m_StatusService, std::move(UpstreamCache))); } } // namespace zen |