diff options
| author | Zousar Shaker <[email protected]> | 2025-09-29 03:55:02 -0600 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-09-29 11:55:02 +0200 |
| commit | bfafc9bfc35bbcb4c1def817c93ad36134bf7983 (patch) | |
| tree | a88bf3244f55cec9780f5287788a11556ddfc229 /src/zenstore/cache | |
| parent | make cpr a HttpClient implementation detail (#517) (diff) | |
| download | zen-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.cpp | 4 |
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; |