From a0bd0821e7a23f1ff3476151c0702be3691dc582 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Fri, 29 Oct 2021 15:10:28 +0200 Subject: CAS.cpp/h -> cas.cpp/h to keep Zen's file casing consistent --- zenserver/cache/structuredcache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'zenserver/cache/structuredcache.cpp') diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 35cb02cbb..0debea3c6 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "monitoring/httpstats.h" #include "structuredcache.h" -- cgit v1.2.3 From 8f12c6bf91ae19215540cf545b57b3ee28c45ee7 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Tue, 2 Nov 2021 15:04:14 +0100 Subject: Unused variables fix --- zenserver/cache/structuredcache.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'zenserver/cache/structuredcache.cpp') diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 0debea3c6..4db8baa32 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -239,7 +239,7 @@ void HttpStructuredCacheService::HandleCacheBucketRequest(HttpServerRequest& Request, std::string_view Bucket) { ZEN_UNUSED(Request, Bucket); - switch (auto Verb = Request.RequestVerb()) + switch (Request.RequestVerb()) { using enum HttpVerb; @@ -262,13 +262,16 @@ HttpStructuredCacheService::HandleCacheBucketRequest(HttpServerRequest& Request, return Request.WriteResponse(HttpResponseCode::NotFound); } break; + + default: + break; } } void HttpStructuredCacheService::HandleCacheRecordRequest(HttpServerRequest& Request, const CacheRef& Ref, CachePolicy Policy) { - switch (auto Verb = Request.RequestVerb()) + switch (Request.RequestVerb()) { using enum HttpVerb; @@ -529,7 +532,7 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request if (StoreUpstream) { ZEN_ASSERT(m_UpstreamCache); - auto Result = m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kBinary, .CacheKey = {Ref.BucketSegment, Ref.HashKey}}); + m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kBinary, .CacheKey = {Ref.BucketSegment, Ref.HashKey}}); } Request.WriteResponse(HttpResponseCode::Created); @@ -574,9 +577,9 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request if (StoreUpstream) { ZEN_ASSERT(m_UpstreamCache); - auto Result = m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbObject, - .CacheKey = {Ref.BucketSegment, Ref.HashKey}, - .PayloadIds = std::move(ValidAttachments)}); + m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbObject, + .CacheKey = {Ref.BucketSegment, Ref.HashKey}, + .PayloadIds = std::move(ValidAttachments)}); } Request.WriteResponse(HttpResponseCode::Created); @@ -668,9 +671,9 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request if (StoreUpstream) { ZEN_ASSERT(m_UpstreamCache); - auto Result = m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbPackage, - .CacheKey = {Ref.BucketSegment, Ref.HashKey}, - .PayloadIds = std::move(ValidAttachments)}); + m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbPackage, + .CacheKey = {Ref.BucketSegment, Ref.HashKey}, + .PayloadIds = std::move(ValidAttachments)}); } Request.WriteResponse(HttpResponseCode::Created); @@ -684,7 +687,7 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request void HttpStructuredCacheService::HandleCachePayloadRequest(HttpServerRequest& Request, const CacheRef& Ref, CachePolicy Policy) { - switch (auto Verb = Request.RequestVerb()) + switch (Request.RequestVerb()) { using enum HttpVerb; @@ -718,7 +721,7 @@ HttpStructuredCacheService::HandleGetCachePayload(zen::HttpServerRequest& Reques { Payload = UpstreamResult.Value; IoHash ChunkHash = IoHash::HashBuffer(Payload); - CasStore::InsertResult Result = m_CasStore.InsertChunk(Payload, ChunkHash); + /*CasStore::InsertResult Result = */ m_CasStore.InsertChunk(Payload, ChunkHash); InUpstreamCache = true; m_CidStore.AddCompressedCid(Ref.PayloadId, ChunkHash); -- cgit v1.2.3 From 7807a69e018a9df96a739dfdb945c648e029f8fe Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Mon, 15 Nov 2021 14:27:58 +0100 Subject: GCC does not like CacheKey member being named the same as its type --- zenserver/cache/structuredcache.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'zenserver/cache/structuredcache.cpp') diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 6fba7648f..ed20e5294 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -448,7 +448,7 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request if (StoreUpstream) { ZEN_ASSERT(m_UpstreamCache); - m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kBinary, .CacheKey = {Ref.BucketSegment, Ref.HashKey}}); + m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kBinary, .Key = {Ref.BucketSegment, Ref.HashKey}}); } Request.WriteResponse(HttpResponseCode::Created); @@ -492,9 +492,9 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request if (StoreUpstream && !IsPartialRecord) { ZEN_ASSERT(m_UpstreamCache); - m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbObject, - .CacheKey = {Ref.BucketSegment, Ref.HashKey}, - .PayloadIds = std::move(ValidAttachments)}); + m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbObject, + .Key = {Ref.BucketSegment, Ref.HashKey}, + .PayloadIds = std::move(ValidAttachments)}); } Request.WriteResponse(HttpResponseCode::Created); @@ -575,7 +575,7 @@ HttpStructuredCacheService::HandlePutCacheRecord(zen::HttpServerRequest& Request { ZEN_ASSERT(m_UpstreamCache); m_UpstreamCache->EnqueueUpstream({.Type = ZenContentType::kCbPackage, - .CacheKey = {Ref.BucketSegment, Ref.HashKey}, + .Key = {Ref.BucketSegment, Ref.HashKey}, .PayloadIds = std::move(ValidAttachments)}); } @@ -931,8 +931,8 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req { ZEN_DEBUG("Uncompressed payload '{}' from upstream cache record '{}/{}'", HashView.AsHash(), - Params.CacheKey.Bucket, - Params.CacheKey.Hash); + Params.Key.Bucket, + Params.Key.Hash); Count.Invalid++; } } @@ -952,8 +952,8 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req if (CacheValue) { ZEN_DEBUG("HIT - '{}/{}' {} '{}' attachments '{}/{}/{}' (new/valid/total) (UPSTREAM)", - Params.CacheKey.Bucket, - Params.CacheKey.Hash, + Params.Key.Bucket, + Params.Key.Hash, NiceBytes(CacheValue.GetSize()), ToString(HttpContentType::kCbPackage), Count.New, @@ -963,7 +963,7 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req CacheValue.SetContentType(ZenContentType::kCbObject); CacheValues[Params.KeyIndex] = CacheValue; - m_CacheStore.Put(Params.CacheKey.Bucket, Params.CacheKey.Hash, {.Value = CacheValue}); + m_CacheStore.Put(Params.Key.Bucket, Params.Key.Hash, {.Value = CacheValue}); m_CacheStats.HitCount++; m_CacheStats.UpstreamHitCount++; @@ -971,7 +971,7 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req else { const bool IsPartial = Count.Valid != Count.Total; - ZEN_DEBUG("MISS - '{}/{}' {}", Params.CacheKey.Bucket, Params.CacheKey.Hash, IsPartial ? "(partial)"sv : ""sv); + ZEN_DEBUG("MISS - '{}/{}' {}", Params.Key.Bucket, Params.Key.Hash, IsPartial ? "(partial)"sv : ""sv); m_CacheStats.MissCount++; } }; -- cgit v1.2.3 From 2a578dfd9d44055592eecedfd98eb2807c4ce294 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Mon, 15 Nov 2021 14:28:35 +0100 Subject: Fixed unused variable warnings --- zenserver/cache/structuredcache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'zenserver/cache/structuredcache.cpp') diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index ed20e5294..107af2333 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -780,7 +780,7 @@ HttpStructuredCacheService::ValidateKeyUri(HttpServerRequest& Request, CacheRef& void HttpStructuredCacheService::HandleRpcRequest(zen::HttpServerRequest& Request) { - switch (auto Verb = Request.RequestVerb()) + switch (Request.RequestVerb()) { using enum HttpVerb; @@ -1137,7 +1137,7 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re const auto OnCachePayloadGetComplete = [this, &ChunkRequests, &Chunks](CachePayloadGetCompleteParams&& Params) { if (CompressedBuffer Compressed = CompressedBuffer::FromCompressed(SharedBuffer(Params.Payload))) { - auto InsertResult = m_CidStore.AddChunk(Compressed); + m_CidStore.AddChunk(Compressed); ZEN_DEBUG("HIT - '{}/{}/{}' {} ({})", Params.Request.Key.Bucket, -- cgit v1.2.3