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/zenstore/cache/structuredcachestore.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/zenstore/cache/structuredcachestore.cpp') diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp index 3f27e6d21..51c80dbc7 100644 --- a/src/zenstore/cache/structuredcachestore.cpp +++ b/src/zenstore/cache/structuredcachestore.cpp @@ -730,7 +730,9 @@ ZenCacheStore::Put(const CacheRequestContext& Context, if (IsKnownBadBucketName(Bucket)) { m_RejectedWriteCount++; - return PutResult{zen::PutStatus::Invalid, "Bad bucket name"}; + CbObjectWriter DetailWriter; + DetailWriter.AddString("Bad bucket name"); + return PutResult{zen::PutStatus::Invalid, DetailWriter.Save()}; } ZEN_MEMSCOPE(GetCacheStoreTag()); @@ -777,7 +779,10 @@ ZenCacheStore::Put(const CacheRequestContext& Context, Namespace, Bucket, HashKey.ToHexString()); - return PutResult{zen::PutStatus::Fail, fmt::format("Unknown namespace '{}'", Namespace)}; + + CbObjectWriter DetailWriter; + DetailWriter.AddString(fmt::format("Unknown namespace '{}'", Namespace)); + return PutResult{zen::PutStatus::Fail, DetailWriter.Save()}; } bool -- cgit v1.2.3 From c7eebb0c8fc5d046d630b462bbfdab1f46bb2d42 Mon Sep 17 00:00:00 2001 From: zousar Date: Tue, 23 Sep 2025 09:26:11 -0600 Subject: Adjust the responses from PUT commands - Ensure that text responses are in a field named "Message" - Change the record response to be named "Record" instead of "Object" --- src/zenstore/cache/structuredcachestore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/zenstore/cache/structuredcachestore.cpp') diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp index 51c80dbc7..b58f70ea7 100644 --- a/src/zenstore/cache/structuredcachestore.cpp +++ b/src/zenstore/cache/structuredcachestore.cpp @@ -731,7 +731,7 @@ ZenCacheStore::Put(const CacheRequestContext& Context, { m_RejectedWriteCount++; CbObjectWriter DetailWriter; - DetailWriter.AddString("Bad bucket name"); + DetailWriter.AddString("Message", "Bad bucket name"); return PutResult{zen::PutStatus::Invalid, DetailWriter.Save()}; } @@ -781,7 +781,7 @@ ZenCacheStore::Put(const CacheRequestContext& Context, HashKey.ToHexString()); CbObjectWriter DetailWriter; - DetailWriter.AddString(fmt::format("Unknown namespace '{}'", Namespace)); + DetailWriter.AddString("Message", fmt::format("Unknown namespace '{}'", Namespace)); return PutResult{zen::PutStatus::Fail, DetailWriter.Save()}; } -- cgit v1.2.3