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/zenremotestore/jupiter/jupitersession.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/zenremotestore/jupiter/jupitersession.cpp')
| -rw-r--r-- | src/zenremotestore/jupiter/jupitersession.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/zenremotestore/jupiter/jupitersession.cpp b/src/zenremotestore/jupiter/jupitersession.cpp index 3dac87d96..dd0e5ad1f 100644 --- a/src/zenremotestore/jupiter/jupitersession.cpp +++ b/src/zenremotestore/jupiter/jupitersession.cpp @@ -184,7 +184,12 @@ JupiterSession::GetObject(std::string_view Namespace, const IoHash& Key) } PutRefResult -JupiterSession::PutRef(std::string_view Namespace, std::string_view BucketId, const IoHash& Key, IoBuffer Ref, ZenContentType RefType) +JupiterSession::PutRef(std::string_view Namespace, + std::string_view BucketId, + const IoHash& Key, + bool Overwrite, + IoBuffer Ref, + ZenContentType RefType) { ZEN_TRACE_CPU("JupiterClient::PutRef"); @@ -192,9 +197,13 @@ JupiterSession::PutRef(std::string_view Namespace, std::string_view BucketId, co IoHash Hash = IoHash::HashBuffer(Ref.Data(), Ref.Size()); - HttpClient::Response Response = m_HttpClient.Put(fmt::format("/api/v1/refs/{}/{}/{}", Namespace, BucketId, Key.ToHexString()), - Ref, - {{"X-Jupiter-IoHash", Hash.ToHexString()}}); + HttpClient::KeyValueMap AdditionalHeaders({{"X-Jupiter-IoHash", Hash.ToHexString()}}); + if (Overwrite) + { + AdditionalHeaders.Entries.emplace("X-Jupiter-Allow-Overwrite", "True"); + } + HttpClient::Response Response = + m_HttpClient.Put(fmt::format("/api/v1/refs/{}/{}/{}", Namespace, BucketId, Key.ToHexString()), Ref, AdditionalHeaders); PutRefResult Result = {detail::ConvertResponse(Response)}; if (Result.Success) |