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/zenutil/cache/cacherequests.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/zenutil/cache/cacherequests.cpp') diff --git a/src/zenutil/cache/cacherequests.cpp b/src/zenutil/cache/cacherequests.cpp index 7c6f493f2..b8169182d 100644 --- a/src/zenutil/cache/cacherequests.cpp +++ b/src/zenutil/cache/cacherequests.cpp @@ -313,6 +313,17 @@ namespace cacherequests { Success.push_back(It.AsBool()); It++; } + + CbArrayView DetailsArray = Package.GetObject()["Details"].AsArrayView(); + if (DetailsArray) + { + It = DetailsArray.CreateViewIterator(); + while (It.HasValue()) + { + Details.push_back(It.AsObjectView()); + It++; + } + } return true; } @@ -325,7 +336,15 @@ namespace cacherequests { ResponseObject.AddBool(Value); } ResponseObject.EndArray(); - + if (!Details.empty()) + { + ResponseObject.BeginArray("Details"); + for (CbObjectView Value : Details) + { + ResponseObject.AddObject(Value); + } + ResponseObject.EndArray(); + } OutPackage.SetObject(ResponseObject.Save()); return true; } -- cgit v1.2.3