From f8d9ac5d13dd37b8b57af0478e77ba1e75c813aa Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 11 May 2021 13:05:39 +0200 Subject: Adding zenservice code --- zenserver/cache/structuredcache.h | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 zenserver/cache/structuredcache.h (limited to 'zenserver/cache/structuredcache.h') diff --git a/zenserver/cache/structuredcache.h b/zenserver/cache/structuredcache.h new file mode 100644 index 000000000..d0646e6e9 --- /dev/null +++ b/zenserver/cache/structuredcache.h @@ -0,0 +1,40 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include + +#include "cachestore.h" +#include "upstream/jupiter.h" + +namespace zen { + +/** + * New-style cache service. Imposes constraints on keys, supports blobs and + * structured values + */ + +class HttpStructuredCacheService : public zen::HttpService +{ +public: + HttpStructuredCacheService(std::filesystem::path RootPath, zen::CasStore& InStore); + ~HttpStructuredCacheService(); + + virtual const char* BaseUri() const override; + + virtual void HandleRequest(zen::HttpServerRequest& Request) override; + +private: + struct CacheRef + { + std::string BucketSegment; + IoHash HashKey; + }; + + [[nodiscard]] bool ValidateUri(zen::HttpServerRequest& Request, CacheRef& OutRef); + + zen::CasStore& m_CasStore; + ZenCacheStore m_CacheStore; +}; + +} // namespace zen -- cgit v1.2.3