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 | |
| parent | Resolved merge from main (diff) | |
| download | zen-c199ec351e98b876ba90651e209791fa2929c476.tar.xz zen-c199ec351e98b876ba90651e209791fa2929c476.zip | |
clang-format
| -rw-r--r-- | zen/zen.cpp | 2 | ||||
| -rw-r--r-- | zenserver/cache/structuredcache.cpp | 28 | ||||
| -rw-r--r-- | zenserver/upstream/upstreamcache.cpp | 30 |
3 files changed, 28 insertions, 32 deletions
diff --git a/zen/zen.cpp b/zen/zen.cpp index fa33d8b31..86c41d658 100644 --- a/zen/zen.cpp +++ b/zen/zen.cpp @@ -14,10 +14,10 @@ #include "cmds/top.h" #include "cmds/up.h" -#include <zencore/zencore.h> #include <zencore/logging.h> #include <zencore/scopeguard.h> #include <zencore/string.h> +#include <zencore/zencore.h> #include <zenstore/cas.h> #if ZEN_WITH_TESTS 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); diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp index 5b7680be2..d6b6d44be 100644 --- a/zenserver/upstream/upstreamcache.cpp +++ b/zenserver/upstream/upstreamcache.cpp @@ -108,7 +108,7 @@ namespace detail { virtual bool Initialize() override { - CloudCacheSession Session(m_Client); + CloudCacheSession Session(m_Client); const CloudCacheResult Result = Session.Authenticate(); return Result.Success; } @@ -120,7 +120,7 @@ namespace detail { try { CloudCacheSession Session(m_Client); - CloudCacheResult Result; + CloudCacheResult Result; if (m_UseLegacyDdc && Type == ZenContentType::kBinary) { @@ -184,7 +184,7 @@ namespace detail { { try { - CloudCacheSession Session(m_Client); + CloudCacheSession Session(m_Client); const CloudCacheResult Result = Session.GetCompressedBlob(PayloadKey.PayloadId); return {.Value = Result.Response, @@ -358,9 +358,9 @@ namespace detail { try { ZenStructuredCacheSession Session(*m_Client); - ZenCacheResult Result; - int64_t TotalBytes = 0ull; - double TotalElapsedSeconds = 0.0; + ZenCacheResult Result; + int64_t TotalBytes = 0ull; + double TotalElapsedSeconds = 0.0; if (CacheRecord.Type == ZenContentType::kCbPackage) { @@ -440,7 +440,7 @@ namespace detail { } private: - std::string m_DisplayName; + std::string m_DisplayName; RefPtr<ZenStructuredCacheClient> m_Client; }; @@ -716,15 +716,15 @@ private: spdlog::logger& Log() { return m_Log; } - spdlog::logger& m_Log; - UpstreamCacheOptions m_Options; - ZenCacheStore& m_CacheStore; - CidStore& m_CidStore; - UpstreamQueue m_UpstreamQueue; - UpstreamStats m_Stats; + spdlog::logger& m_Log; + UpstreamCacheOptions m_Options; + ZenCacheStore& m_CacheStore; + CidStore& m_CidStore; + UpstreamQueue m_UpstreamQueue; + UpstreamStats m_Stats; std::vector<std::unique_ptr<UpstreamEndpoint>> m_Endpoints; - std::vector<std::thread> m_UpstreamThreads; - std::atomic_bool m_IsRunning{false}; + std::vector<std::thread> m_UpstreamThreads; + std::atomic_bool m_IsRunning{false}; }; ////////////////////////////////////////////////////////////////////////// |