aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/cache/structuredcache.cpp')
-rw-r--r--zenserver/cache/structuredcache.cpp28
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);