From fd3946f2b2b013af01fdf60f67afb655c38c1901 Mon Sep 17 00:00:00 2001 From: Per Larsson Date: Tue, 31 Aug 2021 15:01:46 +0200 Subject: Asynchronous upstream caching to Jupiter Co-authored-by: Stefan Boberg --- zenserver/zenserver.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'zenserver/zenserver.cpp') diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 32a468452..395ae5fc2 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -54,12 +54,14 @@ #include "admin/admin.h" #include "cache/kvcache.h" #include "cache/structuredcache.h" +#include "cache/structuredcachestore.h" #include "compute/apply.h" #include "diag/diagsvcs.h" #include "experimental/usnjournal.h" #include "projectstore.h" #include "testing/launch.h" #include "upstream/jupiter.h" +#include "upstream/upstreamcache.h" #include "upstream/zen.h" #include "zenstore/gc.h" #include "zenstore/scrub.h" @@ -139,7 +141,28 @@ public: if (ServiceConfig.StructuredCacheEnabled) { spdlog::info("instantiating structured cache service"); - m_StructuredCacheService.reset(new zen::HttpStructuredCacheService(m_DataRoot / "cache", *m_CasStore, *m_CidStore)); + m_CacheStore = std::make_unique(*m_CasStore, m_DataRoot / "cache"); + + std::unique_ptr UpstreamCache; + if (ServiceConfig.UpstreamCacheEnabled) + { + using namespace std::literals; + + zen::UpstreamCacheOptions UpstreamOptions; + UpstreamOptions.ThreadCount = 4; + UpstreamOptions.JupiterEnabled = true; + UpstreamOptions.JupiterEndpoint = "https://jupiter.devtools-dev.epicgames.com"sv; + UpstreamOptions.JupiterDdcNamespace = "ue4.ddc"sv; + UpstreamOptions.JupiterBlobStoreNamespace = "test.ddc"sv; + UpstreamOptions.JupiterOAuthProvider = "https://epicgames.okta.com/oauth2/auso645ojjWVdRI3d0x7/v1/token"sv; + UpstreamOptions.JupiterOAuthClientId = "0oao91lrhqPiAlaGD0x7"sv; + UpstreamOptions.JupiterOAuthSecret = "-GBWjjenhCgOwhxL5yBKNJECVIoDPH0MK4RDuN7d"sv; + + UpstreamCache = zen::MakeUpstreamCache(UpstreamOptions, *m_CacheStore, *m_CidStore); + } + + m_StructuredCacheService.reset( + new zen::HttpStructuredCacheService(*m_CacheStore, *m_CasStore, *m_CidStore, std::move(UpstreamCache))); } else { @@ -297,6 +320,7 @@ private: zen::HttpServer m_Http; std::unique_ptr m_CasStore{zen::CreateCasStore()}; std::unique_ptr m_CidStore; + std::unique_ptr m_CacheStore; zen::CasGc m_Gc{*m_CasStore}; zen::CasScrubber m_Scrubber{*m_CasStore}; HttpTestService m_TestService; @@ -397,5 +421,7 @@ main(int argc, char* argv[]) SPDLOG_CRITICAL("Caught exception in main: {}", e.what()); } + ShutdownLogging(); + return 0; } -- cgit v1.2.3