aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/upstreamcache.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-09-06 15:17:56 +0200
committerPer Larsson <[email protected]>2021-09-06 15:17:56 +0200
commit8db3555b52168fd7c70244d4f92144a1c4c44e17 (patch)
treed8429393470ff985f6b57c083e6458ee2720c03c /zenserver/upstream/upstreamcache.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-8db3555b52168fd7c70244d4f92144a1c4c44e17.tar.xz
zen-8db3555b52168fd7c70244d4f92144a1c4c44e17.zip
Support for switching between storing derived data using the legacy DDC endpoint and the Commmon Blob Store endpoint.
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
-rw-r--r--zenserver/upstream/upstreamcache.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 40d7ebd26..f7a91acb5 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -89,7 +89,7 @@ namespace detail {
class JupiterUpstreamEndpoint final : public zen::UpstreamEndpoint
{
public:
- JupiterUpstreamEndpoint(const CloudCacheClientOptions& Options)
+ JupiterUpstreamEndpoint(const CloudCacheClientOptions& Options) : m_UseLegacyDdc(Options.UseLegacyDdc)
{
using namespace fmt::literals;
m_DisplayName = "Jupier - '{}'"_format(Options.ServiceUrl);
@@ -100,7 +100,7 @@ namespace detail {
virtual bool Initialize() override
{
- //TODO: Test and authenticate Jupiter client connection
+ // TODO: Test and authenticate Jupiter client connection
return !m_Client->ServiceUrl().empty();
}
@@ -113,13 +113,13 @@ namespace detail {
zen::CloudCacheSession Session(m_Client);
CloudCacheResult Result;
- if (Type == ZenContentType::kBinary)
+ if (m_UseLegacyDdc && Type == ZenContentType::kBinary)
{
Result = Session.GetDerivedData(CacheKey.Bucket, CacheKey.Hash);
}
else
{
- Result = Session.GetRef(CacheKey.Bucket, CacheKey.Hash);
+ Result = Session.GetRef(CacheKey.Bucket, CacheKey.Hash, Type);
}
return {.Value = Result.Value, .Success = Result.Success};
@@ -160,7 +160,17 @@ namespace detail {
CloudCacheResult Result;
for (int32_t Attempt = 0; Attempt < MaxAttempts && !Result.Success; Attempt++)
{
- Result = Session.PutDerivedData(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RecordValue);
+ if (m_UseLegacyDdc)
+ {
+ Result = Session.PutDerivedData(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RecordValue);
+ }
+ else
+ {
+ Result = Session.PutRef(CacheRecord.CacheKey.Bucket,
+ CacheRecord.CacheKey.Hash,
+ RecordValue,
+ ZenContentType::kBinary);
+ }
}
return {.Success = Result.Success};
@@ -185,7 +195,10 @@ namespace detail {
CloudCacheResult Result;
for (int32_t Attempt = 0; Attempt < MaxAttempts && !Result.Success; Attempt++)
{
- Result = Session.PutRef(CacheRecord.CacheKey.Bucket, CacheRecord.CacheKey.Hash, RecordValue);
+ Result = Session.PutRef(CacheRecord.CacheKey.Bucket,
+ CacheRecord.CacheKey.Hash,
+ RecordValue,
+ ZenContentType::kCbObject);
}
return {.Success = Result.Success};
@@ -199,6 +212,7 @@ namespace detail {
}
private:
+ bool m_UseLegacyDdc;
std::string m_DisplayName;
RefPtr<CloudCacheClient> m_Client;
};
@@ -216,8 +230,8 @@ namespace detail {
~ZenUpstreamEndpoint() = default;
virtual bool Initialize() override
- {
- //TODO: Test and authenticate Zen client connection
+ {
+ // TODO: Test and authenticate Zen client connection
return !m_Client->ServiceUrl().empty();
}