aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cache
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2025-09-29 03:55:02 -0600
committerGitHub Enterprise <[email protected]>2025-09-29 11:55:02 +0200
commitbfafc9bfc35bbcb4c1def817c93ad36134bf7983 (patch)
treea88bf3244f55cec9780f5287788a11556ddfc229 /src/zenstore/cache
parentmake cpr a HttpClient implementation detail (#517) (diff)
downloadzen-bfafc9bfc35bbcb4c1def817c93ad36134bf7983.tar.xz
zen-bfafc9bfc35bbcb4c1def817c93ad36134bf7983.zip
GetCacheChunk value request respects RawHash (#518)
When requesting a value via the GetCacheChunks rpc method, if the request specified a raw hash, only return a hit if the raw hash matches what was in the cache.
Diffstat (limited to 'src/zenstore/cache')
-rw-r--r--src/zenstore/cache/cacherpc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/zenstore/cache/cacherpc.cpp b/src/zenstore/cache/cacherpc.cpp
index e4f23816d..fdee017e0 100644
--- a/src/zenstore/cache/cacherpc.cpp
+++ b/src/zenstore/cache/cacherpc.cpp
@@ -1823,7 +1823,9 @@ CacheRpcHandler::GetLocalCacheValues(const CacheRequestContext& Context,
ChunkRequest* Request = ValueRequests[RequestIndex];
if (Chunks[RequestIndex].Value)
{
- if (IsCompressedBinary(Chunks[RequestIndex].Value.GetContentType()))
+ // If the request included a raw hash, only offer a result if the RawHash matched what we found in storage
+ if (IsCompressedBinary(Chunks[RequestIndex].Value.GetContentType()) &&
+ ((Request->Key->ChunkId == IoHash::Zero) || (Request->Key->ChunkId == Chunks[RequestIndex].RawHash)))
{
Request->Key->ChunkId = Chunks[RequestIndex].RawHash;
Request->Exists = true;