diff options
| author | Stefan Boberg <[email protected]> | 2021-09-20 14:03:41 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-20 14:03:55 +0200 |
| commit | c199ec351e98b876ba90651e209791fa2929c476 (patch) | |
| tree | 52e4a7ae739d7bd4d6e2c464706c21fb168caaf8 /zenserver/cache/structuredcache.cpp | |
| parent | Resolved merge from main (diff) | |
| download | zen-c199ec351e98b876ba90651e209791fa2929c476.tar.xz zen-c199ec351e98b876ba90651e209791fa2929c476.zip | |
clang-format
Diffstat (limited to 'zenserver/cache/structuredcache.cpp')
| -rw-r--r-- | zenserver/cache/structuredcache.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 84522748e..17f8e04ef 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -145,8 +145,8 @@ ParseCachePolicy(const HttpServerRequest::QueryParams& QueryParams) ////////////////////////////////////////////////////////////////////////// HttpStructuredCacheService::HttpStructuredCacheService(ZenCacheStore& InCacheStore, - CasStore& InStore, - CidStore& InCidStore, + CasStore& InStore, + CidStore& InCidStore, std::unique_ptr<UpstreamCache> UpstreamCache) : m_Log(logging::Get("cache")) , m_CacheStore(InCacheStore) @@ -188,7 +188,7 @@ HttpStructuredCacheService::HandleRequest(HttpServerRequest& Request) return HandleCacheBucketRequest(Request, Key); } - return Request.WriteResponse(HttpResponseCode::BadRequest); // invalid URL + return Request.WriteResponse(HttpResponseCode::BadRequest); // invalid URL } const auto QueryParams = Request.GetQueryParams(); @@ -252,8 +252,7 @@ HttpStructuredCacheService::HandleCacheRecordRequest(HttpServerRequest& Request, bool Success = m_CacheStore.Get(Ref.BucketSegment, Ref.HashKey, /* out */ Value); bool InUpstreamCache = false; - const bool QueryUpstream = - !Success && m_UpstreamCache && (CachePolicy::QueryRemote == (Policy & CachePolicy::QueryRemote)); + const bool QueryUpstream = !Success && m_UpstreamCache && (CachePolicy::QueryRemote == (Policy & CachePolicy::QueryRemote)); if (QueryUpstream) { @@ -272,8 +271,7 @@ HttpStructuredCacheService::HandleCacheRecordRequest(HttpServerRequest& Request, { if (CacheRecordType == ZenContentType::kCbObject) { - const CbValidateError ValidationResult = - ValidateCompactBinary(UpstreamResult.Value, CbValidateMode::All); + const CbValidateError ValidationResult = ValidateCompactBinary(UpstreamResult.Value, CbValidateMode::All); if (ValidationResult == CbValidateError::None) { @@ -688,8 +686,8 @@ HttpStructuredCacheService::HandleCachePayloadRequest(HttpServerRequest& Request case kHead: case kGet: { - IoBuffer Payload = m_CidStore.FindChunkByCid(Ref.PayloadId); - bool InUpstreamCache = false; + IoBuffer Payload = m_CidStore.FindChunkByCid(Ref.PayloadId); + bool InUpstreamCache = false; if (!Payload && m_UpstreamCache) { @@ -698,10 +696,10 @@ HttpStructuredCacheService::HandleCachePayloadRequest(HttpServerRequest& Request { if (CompressedBuffer Compressed = CompressedBuffer::FromCompressed(SharedBuffer(UpstreamResult.Value))) { - Payload = UpstreamResult.Value; - IoHash ChunkHash = IoHash::HashBuffer(Payload); - CasStore::InsertResult Result = m_CasStore.InsertChunk(Payload, ChunkHash); - InUpstreamCache = true; + Payload = UpstreamResult.Value; + IoHash ChunkHash = IoHash::HashBuffer(Payload); + CasStore::InsertResult Result = m_CasStore.InsertChunk(Payload, ChunkHash); + InUpstreamCache = true; m_CidStore.AddCompressedCid(Ref.PayloadId, ChunkHash); } @@ -741,9 +739,7 @@ HttpStructuredCacheService::HandleCachePayloadRequest(HttpServerRequest& Request { if (Body.Size() == 0) { - return Request.WriteResponse(HttpResponseCode::BadRequest, - HttpContentType::kText, - "Empty payload not permitted"); + return Request.WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, "Empty payload not permitted"); } IoHash ChunkHash = IoHash::HashBuffer(Body); |