aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/cache/cacherequests.cpp
diff options
context:
space:
mode:
authorzousar <[email protected]>2025-09-19 23:46:52 -0600
committerzousar <[email protected]>2025-09-19 23:46:52 -0600
commit7a94b22eafdbd3f394fb9200e713cbb3b2b0cd56 (patch)
tree2ff8345484208d100000d8be805ff8f13dd2e7cc /src/zenutil/cache/cacherequests.cpp
parentfix quoted wildcard options (#500) (diff)
downloadzen-7a94b22eafdbd3f394fb9200e713cbb3b2b0cd56.tar.xz
zen-7a94b22eafdbd3f394fb9200e713cbb3b2b0cd56.zip
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.
Diffstat (limited to 'src/zenutil/cache/cacherequests.cpp')
-rw-r--r--src/zenutil/cache/cacherequests.cpp21
1 files changed, 20 insertions, 1 deletions
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;
}