diff options
| author | mattpetersepic <[email protected]> | 2022-01-25 06:57:47 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-25 06:57:47 -0700 |
| commit | bd85a74a9d15fd676a6677fbd4d5ab4e3dcb0d42 (patch) | |
| tree | e59bd4eccbc667088e74e989f2cfbbf82c6926c0 /zenserver/upstream/upstreamcache.cpp | |
| parent | Fixed unexpected abort() call when joining an unjoinable thread (diff) | |
| download | zen-bd85a74a9d15fd676a6677fbd4d5ab4e3dcb0d42.tar.xz zen-bd85a74a9d15fd676a6677fbd4d5ab4e3dcb0d42.zip | |
Cachepolicy (#36)
* Copy CachePolicy implementation from UE5/Release-5.0. Add backwards compatability for clients and upstreams that are using the old protocol.
* Add RefPtr templated move operator and constructor, so that RefPtr<const Foo*> A = std::move(RefPtr<Foo*>()) will do a move.
* Fix broken CachePolicy tests and add tests for new Save/Load.
* Remove TODO comments
* CachePolicy Save/Load Fixes from codereview
* Fix comment to match code change.
* Remove backwards compatibility for CachePolicy change. Convert policy string tokens to PascalCase. Fix tests for new policy text. Change ParseCachePolicy to assert string is non-empty and always succeed.
* Fix release build: use ZEN_WITH_TESTS define
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
| -rw-r--r-- | zenserver/upstream/upstreamcache.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp index 3d6641a4f..b0343a61b 100644 --- a/zenserver/upstream/upstreamcache.cpp +++ b/zenserver/upstream/upstreamcache.cpp @@ -378,7 +378,7 @@ namespace detail { if (It == std::end(CacheRecord.PayloadIds)) { - OutReason = fmt::format("payload '{}' MISSING from local cache", PayloadId); + OutReason = fmt::format("value '{}' MISSING from local cache", PayloadId); return false; } @@ -394,7 +394,7 @@ namespace detail { if (!BlobResult.Success) { - OutReason = fmt::format("upload payload '{}' FAILED, reason '{}'", PayloadId, BlobResult.Reason); + OutReason = fmt::format("upload value '{}' FAILED, reason '{}'", PayloadId, BlobResult.Reason); return false; } @@ -473,7 +473,7 @@ namespace detail { Sb << MissingHash.ToHexString() << ","; } - return {.Reason = fmt::format("finalize '{}/{}' FAILED, still needs payload(s) '{}'", + return {.Reason = fmt::format("finalize '{}/{}' FAILED, still needs value(s) '{}'", CacheRecord.Key.Bucket, CacheRecord.Key.Hash, Sb.ToString()), @@ -646,9 +646,8 @@ namespace detail { } BatchRequest.EndArray(); - BatchRequest.BeginObject("Policy"sv); - CacheRecordPolicy::Save(Policy, BatchRequest); - BatchRequest.EndObject(); + BatchRequest.SetName("Policy"sv); + Policy.Save(BatchRequest); } BatchRequest.EndObject(); @@ -726,7 +725,7 @@ namespace detail { CbObjectWriter BatchRequest; BatchRequest << "Method"sv - << "GetCachePayloads"; + << "GetCacheValues"; BatchRequest.BeginObject("Params"sv); { @@ -743,12 +742,11 @@ namespace detail { BatchRequest << "Bucket"sv << Request.Key.Bucket; BatchRequest << "Hash"sv << Request.Key.Hash; BatchRequest.EndObject(); - - BatchRequest.AddObjectId("PayloadId"sv, Request.PayloadId); + BatchRequest.AddObjectId("ValueId"sv, Request.PayloadId); BatchRequest << "ChunkId"sv << Request.ChunkId; BatchRequest << "RawOffset"sv << Request.RawOffset; BatchRequest << "RawSize"sv << Request.RawSize; - BatchRequest << "Policy"sv << static_cast<uint32_t>(Request.Policy); + BatchRequest << "Policy"sv << WriteToString<128>(Request.Policy).ToView(); } BatchRequest.EndObject(); } @@ -828,7 +826,7 @@ namespace detail { } else { - return {.Reason = std::string("invalid payload buffer"), .Success = false}; + return {.Reason = std::string("invalid value buffer"), .Success = false}; } } |