aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/cache/cacherpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenstore/cache/cacherpc.cpp')
-rw-r--r--src/zenstore/cache/cacherpc.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/zenstore/cache/cacherpc.cpp b/src/zenstore/cache/cacherpc.cpp
index 6469d6c31..660c66b9a 100644
--- a/src/zenstore/cache/cacherpc.cpp
+++ b/src/zenstore/cache/cacherpc.cpp
@@ -494,7 +494,8 @@ CacheRpcHandler::PutCacheRecord(PutRequestData& Request, const CbPackage* Packag
m_UpstreamCache.EnqueueUpstream({.Type = ZenContentType::kCbPackage,
.Namespace = Request.Namespace,
.Key = Request.Key,
- .ValueContentIds = std::move(ValidAttachments)});
+ .ValueContentIds = std::move(ValidAttachments),
+ .Overwrite = Overwrite});
}
return PutResult;
}
@@ -998,6 +999,7 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
eastl::fixed_vector<size_t, 32> BatchResultIndexes;
eastl::fixed_vector<ZenCacheStore::PutResult, 32> Results;
eastl::fixed_vector<CacheKey, 32> UpstreamCacheKeys;
+ eastl::fixed_vector<bool, 32> Overwrites;
uint64_t RequestCount = RequestsArray.Num();
{
@@ -1008,6 +1010,7 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
Batch = std::make_unique<ZenCacheStore::PutBatch>(m_CacheStore, *Namespace, BatchResults);
BatchResults.reserve(RequestCount);
BatchResultIndexes.reserve(RequestCount);
+ Overwrites.reserve(RequestCount);
}
for (CbFieldView RequestField : RequestsArray)
{
@@ -1032,6 +1035,7 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
uint64_t RawSize = RequestObject["RawSize"sv].AsUInt64();
bool Valid = false;
uint64_t TransferredSize = 0;
+ bool Overwrite = false;
if (const CbAttachment* Attachment = BatchRequest.FindAttachment(RawHash))
{
@@ -1047,8 +1051,8 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
if (EnumHasAllFlags(Policy, CachePolicy::StoreLocal))
{
- bool Overwrite = !EnumHasAllFlags(Policy, CachePolicy::QueryLocal);
- IoBuffer Value = Chunk.GetCompressed().Flatten().AsIoBuffer();
+ Overwrite = !EnumHasAllFlags(Policy, CachePolicy::QueryLocal);
+ IoBuffer Value = Chunk.GetCompressed().Flatten().AsIoBuffer();
Value.SetContentType(ZenContentType::kCompressedBinary);
if (RawSize == 0)
{
@@ -1116,6 +1120,7 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
{
UpstreamCacheKeys.push_back(CacheKey::Empty);
}
+ Overwrites.push_back(Overwrite);
ZEN_DEBUG("PUTCACHEVALUES - '{}/{}/{}' {}, '{}' in {}",
*Namespace,
@@ -1150,8 +1155,10 @@ CacheRpcHandler::HandleRpcPutCacheValues(const CacheRequestContext& Context, con
{
if ((Results[Index].Status == zen::PutStatus::Success) && UpstreamCacheKeys[Index] != CacheKey::Empty)
{
- m_UpstreamCache.EnqueueUpstream(
- {.Type = ZenContentType::kCompressedBinary, .Namespace = *Namespace, .Key = UpstreamCacheKeys[Index]});
+ m_UpstreamCache.EnqueueUpstream({.Type = ZenContentType::kCompressedBinary,
+ .Namespace = *Namespace,
+ .Key = UpstreamCacheKeys[Index],
+ .Overwrite = Overwrites[Index]});
}
}
{