From 7a94b22eafdbd3f394fb9200e713cbb3b2b0cd56 Mon Sep 17 00:00:00 2001 From: zousar Date: Fri, 19 Sep 2025 23:46:52 -0600 Subject: Change batch put responses for client reporting Conflicts are now treated as successes, and we optionally return a Details array instead of an ErrorMessages array. Details are returned for all requests in a batch, or no requests in a batch depending on whether there are any details to be shared about any of the put requests. The details for a conflict include the raw hash and raw size of the item. If the item is a record, we also include the record as an object. --- src/zenserver/cache/httpstructuredcache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/zenserver/cache/httpstructuredcache.cpp') diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index c83065506..dc14465de 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -1221,8 +1221,11 @@ HttpStructuredCacheService::HandlePutCacheRecord(HttpServerRequest& Request, con break; } - return PutResult.Message.empty() ? Request.WriteResponse(ResponseCode) - : Request.WriteResponse(ResponseCode, zen::HttpContentType::kText, PutResult.Message); + if (PutResult.Details) + { + Request.WriteResponse(ResponseCode, PutResult.Details); + } + return Request.WriteResponse(ResponseCode); }; const HttpContentType ContentType = Request.RequestContentType(); -- cgit v1.2.3 From ebfade799e7199f7c6b981f17a55ed67d4323c41 Mon Sep 17 00:00:00 2001 From: zousar Date: Wed, 24 Sep 2025 22:12:11 -0600 Subject: Report Incomplete Records To Client When requesting partial records, report back when a record is incomplete via an "Incomplete" array of bools that is a sibling to the "Result" array for batch/rpc operations, or via the HttpResponseCode::PartialContent status code for individual record requests. --- src/zenserver/cache/httpstructuredcache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/zenserver/cache/httpstructuredcache.cpp') diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index dc14465de..bc3f4ee20 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -821,7 +821,8 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con const bool SkipData = EnumHasAllFlags(PolicyFromUrl, CachePolicy::SkipData); const bool PartialRecord = EnumHasAllFlags(PolicyFromUrl, CachePolicy::PartialRecord); - bool Success = false; + bool Success = false; + uint32_t MissingCount = 0; ZenCacheValue ClientResultValue; if (!EnumHasAnyFlags(PolicyFromUrl, CachePolicy::Query)) { @@ -844,7 +845,6 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con if (ContentType == ZenContentType::kCbObject) { CbPackage Package; - uint32_t MissingCount = 0; CbValidateError ValidateError = CbValidateError::None; if (CbObject PackageObject = ValidateAndReadCompactBinaryObject(std::move(ClientResultValue.Value), ValidateError); ValidateError == CbValidateError::None) @@ -936,7 +936,9 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con else { // kCbPackage handled SkipData when constructing the ClientResultValue, kcbObject ignores SkipData - return Request.WriteResponse(HttpResponseCode::OK, ClientResultValue.Value.GetContentType(), ClientResultValue.Value); + return Request.WriteResponse((MissingCount == 0) ? HttpResponseCode::OK : HttpResponseCode::PartialContent, + ClientResultValue.Value.GetContentType(), + ClientResultValue.Value); } } else if (!HasUpstream || !EnumHasAllFlags(PolicyFromUrl, CachePolicy::QueryRemote)) -- cgit v1.2.3