aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2022-01-26 12:36:21 +0100
committerStefan Boberg <[email protected]>2022-01-26 12:36:21 +0100
commit1b03128af0eb96f192ab643ca1fec3d62c7ed161 (patch)
tree1cde199c2f605c8aa2c4a2a0705d6651394ab403
parentSuper temporary sentry symbol upload script to help jog my memory whenever I ... (diff)
parentFixed issue with missing endpoint name when configuring upstream cache from Lua. (diff)
downloadzen-1b03128af0eb96f192ab643ca1fec3d62c7ed161.tar.xz
zen-1b03128af0eb96f192ab643ca1fec3d62c7ed161.zip
Merge branch 'main' of https://github.com/EpicGames/zen
-rw-r--r--zencore/include/zencore/refcount.h1
-rw-r--r--zenserver/config.cpp13
-rw-r--r--zenserver/config.h2
-rw-r--r--zenserver/upstream/upstreamcache.cpp4
-rw-r--r--zenserver/zenserver.cpp32
-rw-r--r--zenutil/cache/cachepolicy.cpp1
6 files changed, 36 insertions, 17 deletions
diff --git a/zencore/include/zencore/refcount.h b/zencore/include/zencore/refcount.h
index afee8536f..254a22db5 100644
--- a/zencore/include/zencore/refcount.h
+++ b/zencore/include/zencore/refcount.h
@@ -114,6 +114,7 @@ public:
private:
T* m_Ref = nullptr;
+ template <typename U>
friend class RefPtr;
};
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 3c4f6f3d8..a36ce5f33 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -337,10 +337,10 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
exit(0);
}
- ServerOptions.DataDir = DataDir;
- ServerOptions.ContentDir = ContentDir;
- ServerOptions.AbsLogFile = AbsLogFile;
- ServerOptions.ConfigFile = ConfigFile;
+ ServerOptions.DataDir = DataDir;
+ ServerOptions.ContentDir = ContentDir;
+ ServerOptions.AbsLogFile = AbsLogFile;
+ ServerOptions.ConfigFile = ConfigFile;
ServerOptions.UpstreamCacheConfig.CachePolicy = ParseUpstreamCachePolicy(UpstreamCachePolicyOptions);
if (!ServerOptions.ConfigFile.empty())
@@ -479,6 +479,9 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio
if (auto JupiterConfig = UpstreamConfig->get<sol::optional<sol::table>>("jupiter"))
{
UpdateStringValueFromConfig(JupiterConfig.value(),
+ std::string_view("name"),
+ ServerOptions.UpstreamCacheConfig.JupiterConfig.Name);
+ UpdateStringValueFromConfig(JupiterConfig.value(),
std::string_view("url"),
ServerOptions.UpstreamCacheConfig.JupiterConfig.Url);
UpdateStringValueFromConfig(JupiterConfig.value(),
@@ -507,6 +510,8 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio
if (auto ZenConfig = UpstreamConfig->get<sol::optional<sol::table>>("zen"))
{
+ ServerOptions.UpstreamCacheConfig.ZenConfig.Name = ZenConfig.value().get_or("name", std::string("Zen"));
+
if (auto Url = ZenConfig.value().get<sol::optional<std::string>>("url"))
{
ServerOptions.UpstreamCacheConfig.ZenConfig.Urls.push_back(Url.value());
diff --git a/zenserver/config.h b/zenserver/config.h
index 2c31e7bd9..e38b5c704 100644
--- a/zenserver/config.h
+++ b/zenserver/config.h
@@ -21,6 +21,7 @@
struct ZenUpstreamJupiterConfig
{
+ std::string Name;
std::string Url;
std::string OAuthProvider;
std::string OAuthClientId;
@@ -34,6 +35,7 @@ struct ZenUpstreamJupiterConfig
struct ZenUpstreamZenConfig
{
+ std::string Name;
std::vector<std::string> Urls;
std::vector<std::string> Dns;
};
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index b0343a61b..8b02a437a 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -535,10 +535,12 @@ namespace detail {
public:
ZenUpstreamEndpoint(const ZenStructuredCacheClientOptions& Options)
: m_Log(zen::logging::Get("upstream"))
- , m_Info({.Name = std::string(Options.Name)})
, m_ConnectTimeout(Options.ConnectTimeout)
, m_Timeout(Options.Timeout)
{
+ ZEN_ASSERT(!Options.Name.empty());
+ m_Info.Name = Options.Name;
+
for (const auto& Url : Options.Urls)
{
m_Endpoints.push_back({.Url = Url});
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index b8648c8ee..6a42a4044 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -678,7 +678,6 @@ void
ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
{
using namespace std::literals;
- 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_CasGc, m_DataRoot / "cache");
@@ -722,8 +721,10 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
if (!ZenUrls.empty())
{
+ const auto ZenEndpointName = UpstreamConfig.ZenConfig.Name.empty() ? "Zen"sv : UpstreamConfig.ZenConfig.Name;
+
std::unique_ptr<zen::UpstreamEndpoint> ZenEndpoint =
- zen::MakeZenUpstreamEndpoint({.Name = "Zen"sv,
+ zen::MakeZenUpstreamEndpoint({.Name = ZenEndpointName,
.Urls = ZenUrls,
.ConnectTimeout = std::chrono::milliseconds(UpstreamConfig.ConnectTimeoutMilliseconds),
.Timeout = std::chrono::milliseconds(UpstreamConfig.TimeoutMilliseconds)});
@@ -737,7 +738,7 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
if (UpstreamConfig.JupiterConfig.UseProductionSettings)
{
Options =
- zen::CloudCacheClientOptions{.Name = "Horde"sv,
+ zen::CloudCacheClientOptions{.Name = "Jupiter-Prod"sv,
.ServiceUrl = "https://jupiter.devtools.epicgames.com"sv,
.DdcNamespace = "ue.ddc"sv,
.BlobStoreNamespace = "ue.ddc"sv,
@@ -751,7 +752,7 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
else if (UpstreamConfig.JupiterConfig.UseDevelopmentSettings)
{
Options =
- zen::CloudCacheClientOptions{.Name = "Horde"sv,
+ zen::CloudCacheClientOptions{.Name = "Jupiter-Dev"sv,
.ServiceUrl = "https://jupiter.devtools-dev.epicgames.com"sv,
.DdcNamespace = "ue.ddc"sv,
.BlobStoreNamespace = "ue.ddc"sv,
@@ -762,14 +763,23 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
.Timeout = std::chrono::milliseconds(UpstreamConfig.TimeoutMilliseconds),
.UseLegacyDdc = false};
}
+ else
+ {
+ const auto JupiterEndpointName =
+ UpstreamConfig.JupiterConfig.Name.empty() ? "Jupiter"sv : UpstreamConfig.JupiterConfig.Name;
- Options.ServiceUrl = ValueOrDefault(UpstreamConfig.JupiterConfig.Url, Options.ServiceUrl);
- Options.DdcNamespace = ValueOrDefault(UpstreamConfig.JupiterConfig.DdcNamespace, Options.DdcNamespace);
- Options.BlobStoreNamespace = ValueOrDefault(UpstreamConfig.JupiterConfig.Namespace, Options.BlobStoreNamespace);
- Options.OAuthProvider = ValueOrDefault(UpstreamConfig.JupiterConfig.OAuthProvider, Options.OAuthProvider);
- Options.OAuthClientId = ValueOrDefault(UpstreamConfig.JupiterConfig.OAuthClientId, Options.OAuthClientId);
- Options.OAuthSecret = ValueOrDefault(UpstreamConfig.JupiterConfig.OAuthClientSecret, Options.OAuthSecret);
- Options.UseLegacyDdc |= UpstreamConfig.JupiterConfig.UseLegacyDdc;
+ Options =
+ zen::CloudCacheClientOptions{.Name = JupiterEndpointName,
+ .ServiceUrl = UpstreamConfig.JupiterConfig.Url,
+ .DdcNamespace = UpstreamConfig.JupiterConfig.DdcNamespace,
+ .BlobStoreNamespace = UpstreamConfig.JupiterConfig.Namespace,
+ .OAuthProvider = UpstreamConfig.JupiterConfig.OAuthProvider,
+ .OAuthClientId = UpstreamConfig.JupiterConfig.OAuthClientId,
+ .OAuthSecret = UpstreamConfig.JupiterConfig.OAuthClientSecret,
+ .ConnectTimeout = std::chrono::milliseconds(UpstreamConfig.ConnectTimeoutMilliseconds),
+ .Timeout = std::chrono::milliseconds(UpstreamConfig.TimeoutMilliseconds),
+ .UseLegacyDdc = false};
+ }
if (!Options.ServiceUrl.empty())
{
diff --git a/zenutil/cache/cachepolicy.cpp b/zenutil/cache/cachepolicy.cpp
index 142ba682a..ba345485a 100644
--- a/zenutil/cache/cachepolicy.cpp
+++ b/zenutil/cache/cachepolicy.cpp
@@ -15,7 +15,6 @@ using namespace std::literals;
namespace detail::CachePolicyImpl {
constexpr char DelimiterChar = ',';
- constexpr std::string_view Delimiter = ","sv;
constexpr std::string_view None = "None"sv;
constexpr std::string_view QueryLocal = "QueryLocal"sv;
constexpr std::string_view QueryRemote = "QueryRemote"sv;