diff options
| author | zousar <[email protected]> | 2025-12-19 00:49:38 -0700 |
|---|---|---|
| committer | zousar <[email protected]> | 2025-12-19 00:49:38 -0700 |
| commit | 774d39bf193dd84b76437abcd41df2478e3431c0 (patch) | |
| tree | af6550d5f2f0e292775843473260df1e2872e63a /src/zenserver/storage/upstream/zen.cpp | |
| parent | Change default limit-overwrite behavior to true (diff) | |
| download | zen-774d39bf193dd84b76437abcd41df2478e3431c0.tar.xz zen-774d39bf193dd84b76437abcd41df2478e3431c0.zip | |
Ensure upstream put propagation includes overwrite
When changing the default limit-overwrite behavior, a unit test surfaced a bug where an put of data with overwrite cache policy would not get propagated via zen's built-in upstream mechanism with a matching overwrite cache policy to the upstream. This change ensures that it does and leaves the unit test configured to exercise this scenario.
Diffstat (limited to 'src/zenserver/storage/upstream/zen.cpp')
| -rw-r--r-- | src/zenserver/storage/upstream/zen.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/zenserver/storage/upstream/zen.cpp b/src/zenserver/storage/upstream/zen.cpp index 25fd3a3bb..423c9039c 100644 --- a/src/zenserver/storage/upstream/zen.cpp +++ b/src/zenserver/storage/upstream/zen.cpp @@ -127,6 +127,7 @@ ZenCacheResult ZenStructuredCacheSession::PutCacheRecord(std::string_view Namespace, std::string_view BucketId, const IoHash& Key, + CachePolicy Policy, IoBuffer Value, ZenContentType Type) { @@ -140,6 +141,12 @@ ZenStructuredCacheSession::PutCacheRecord(std::string_view Namespace, } Uri << BucketId << "/" << Key.ToHexString(); + if (Policy != CachePolicy::Default) + { + Uri << "?Policy="; + Uri << Policy; + } + Value.SetContentType(Type); HttpClient::Response Response = Http.Put(Uri, Value); @@ -159,6 +166,7 @@ ZenCacheResult ZenStructuredCacheSession::PutCacheValue(std::string_view Namespace, std::string_view BucketId, const IoHash& Key, + CachePolicy Policy, const IoHash& ValueContentId, IoBuffer Payload) { @@ -172,6 +180,12 @@ ZenStructuredCacheSession::PutCacheValue(std::string_view Namespace, } Uri << BucketId << "/" << Key.ToHexString() << "/" << ValueContentId.ToHexString(); + if (Policy != CachePolicy::Default) + { + Uri << "?Policy="; + Uri << Policy; + } + Payload.SetContentType(HttpContentType::kCompressedBinary); HttpClient::Response Response = Http.Put(Uri, Payload); |