aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcache.h
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-11 13:05:39 +0200
committerStefan Boberg <[email protected]>2021-05-11 13:05:39 +0200
commitf8d9ac5d13dd37b8b57af0478e77ba1e75c813aa (patch)
tree1daf7621e110d48acd5e12e3073ce48ef0dd11b2 /zenserver/cache/structuredcache.h
downloadzen-f8d9ac5d13dd37b8b57af0478e77ba1e75c813aa.tar.xz
zen-f8d9ac5d13dd37b8b57af0478e77ba1e75c813aa.zip
Adding zenservice code
Diffstat (limited to 'zenserver/cache/structuredcache.h')
-rw-r--r--zenserver/cache/structuredcache.h40
1 files changed, 40 insertions, 0 deletions
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 <zencore/httpserver.h>
+
+#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