diff options
| author | Stefan Boberg <[email protected]> | 2021-10-21 22:06:20 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-21 22:06:20 +0200 |
| commit | 05d7c8d02216174c856dcdc9f21f541d79461392 (patch) | |
| tree | 93b4a84d1265ea55e06ce9974ef6f2c4e4c6ef27 | |
| parent | filecas: minor code restructuring (diff) | |
| download | zen-05d7c8d02216174c856dcdc9f21f541d79461392.tar.xz zen-05d7c8d02216174c856dcdc9f21f541d79461392.zip | |
z$: Removed CasStore
| -rw-r--r-- | zenserver-test/zenserver-test.cpp | 10 | ||||
| -rw-r--r-- | zenserver/cache/structuredcache.cpp | 13 | ||||
| -rw-r--r-- | zenserver/cache/structuredcache.h | 2 | ||||
| -rw-r--r-- | zenserver/zenserver.cpp | 1 |
4 files changed, 10 insertions, 16 deletions
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp index 23be9f729..41dfe8563 100644 --- a/zenserver-test/zenserver-test.cpp +++ b/zenserver-test/zenserver-test.cpp @@ -53,6 +53,8 @@ ZEN_THIRD_PARTY_INCLUDES_END #include <asio.hpp> +#define ZEN_USE_EXEC 0 // Note: this should really be a global define to match the zenserver definition + ////////////////////////////////////////////////////////////////////////// #include "projectclient.h" @@ -1880,6 +1882,8 @@ TEST_CASE("zcache.policy") } } +#if ZEN_USE_EXEC + struct RemoteExecutionRequest { RemoteExecutionRequest(std::string_view Host, int Port, std::filesystem::path& TreePath) @@ -2035,7 +2039,7 @@ TEST_CASE("exec.basic") RemoteRequest.Prep(); zen::CbObject Result = RemoteRequest.Exec(); - CHECK(Result["exitcode"].AsInt32(-1) == 0); + CHECK(Result["exitcode"sv].AsInt32(-1) == 0); } { @@ -2044,7 +2048,7 @@ TEST_CASE("exec.basic") RemoteRequest.Prep(); zen::CbObject Result = RemoteRequest.Exec(); - CHECK(Result["exitcode"].AsInt32(-1) == 1); + CHECK(Result["exitcode"sv].AsInt32(-1) == 1); } } @@ -2079,6 +2083,8 @@ TEST_CASE("mesh.basic") # endif } +#endif + class ZenServerTestHelper { public: diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 35cb02cbb..bcb0b1f82 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -148,7 +148,6 @@ ParseCachePolicy(const HttpServerRequest::QueryParams& QueryParams) ////////////////////////////////////////////////////////////////////////// HttpStructuredCacheService::HttpStructuredCacheService(ZenCacheStore& InCacheStore, - CasStore& InStore, CidStore& InCidStore, HttpStatsService& StatsService, HttpStatusService& StatusService, @@ -157,7 +156,6 @@ HttpStructuredCacheService::HttpStructuredCacheService(ZenCacheStore& InCac , m_CacheStore(InCacheStore) , m_StatsService(StatsService) , m_StatusService(StatusService) -, m_CasStore(InStore) , m_CidStore(InCidStore) , m_UpstreamCache(std::move(UpstreamCache)) { @@ -194,7 +192,6 @@ HttpStructuredCacheService::Scrub(ScrubContext& Ctx) m_LastScrubTime = Ctx.ScrubTimestamp(); - m_CasStore.Scrub(Ctx); m_CidStore.Scrub(Ctx); m_CacheStore.Scrub(Ctx); } @@ -716,12 +713,8 @@ HttpStructuredCacheService::HandleGetCachePayload(zen::HttpServerRequest& Reques { if (CompressedBuffer Compressed = CompressedBuffer::FromCompressed(SharedBuffer(UpstreamResult.Value))) { - Payload = UpstreamResult.Value; - IoHash ChunkHash = IoHash::HashBuffer(Payload); - CasStore::InsertResult Result = m_CasStore.InsertChunk(Payload, ChunkHash); + CidStore::InsertResult Result = m_CidStore.AddChunk(Compressed); InUpstreamCache = true; - - m_CidStore.AddCompressedCid(Ref.PayloadId, ChunkHash); } else { @@ -789,9 +782,7 @@ HttpStructuredCacheService::HandlePutCachePayload(zen::HttpServerRequest& Reques return Request.WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, "Payload ID does not match attachment hash"sv); } - CasStore::InsertResult Result = m_CasStore.InsertChunk(Body, ChunkHash); - - m_CidStore.AddCompressedCid(Ref.PayloadId, ChunkHash); + CidStore::InsertResult Result = m_CidStore.AddChunk(Compressed); ZEN_DEBUG("PUT - '{}/{}/{}' {} '{}' ({})", Ref.BucketSegment, diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h index ad7253f79..68a01becb 100644 --- a/zenserver/cache/structuredcache.h +++ b/zenserver/cache/structuredcache.h @@ -54,7 +54,6 @@ class HttpStructuredCacheService : public HttpService, public IHttpStatsProvider { public: HttpStructuredCacheService(ZenCacheStore& InCacheStore, - CasStore& InCasStore, CidStore& InCidStore, HttpStatsService& StatsService, HttpStatusService& StatusService, @@ -98,7 +97,6 @@ private: ZenCacheStore& m_CacheStore; HttpStatsService& m_StatsService; HttpStatusService& m_StatusService; - CasStore& m_CasStore; CidStore& m_CidStore; std::unique_ptr<UpstreamCache> m_UpstreamCache; uint64_t m_LastScrubTime = 0; diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 9a729c440..73a66bdac 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -681,7 +681,6 @@ ZenServer::InitializeStructuredCache(ZenServiceConfig& ServiceConfig) } m_StructuredCacheService.reset(new zen::HttpStructuredCacheService(*m_CacheStore, - *m_CasStore, *m_CidStore, m_StatsService, m_StatusService, |