aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/zen.h
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-09-03 15:37:19 +0200
committerGitHub <[email protected]>2021-09-03 15:37:19 +0200
commitc04fa527593da17c719c4d899ec19caeb6480a94 (patch)
treefa65fd7585d55712bad546d76a0fc3518023a905 /zenserver/upstream/zen.h
parentoops: Fixed AssertException implementation namespace (diff)
downloadzen-c04fa527593da17c719c4d899ec19caeb6480a94.tar.xz
zen-c04fa527593da17c719c4d899ec19caeb6480a94.zip
Zen upstream support (#7)
Diffstat (limited to 'zenserver/upstream/zen.h')
-rw-r--r--zenserver/upstream/zen.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/zenserver/upstream/zen.h b/zenserver/upstream/zen.h
index 1d7d5752e..5df6da4a3 100644
--- a/zenserver/upstream/zen.h
+++ b/zenserver/upstream/zen.h
@@ -20,6 +20,10 @@
struct ZenCacheValue;
+namespace spdlog {
+class logger;
+}
+
namespace zen {
class CbObjectWriter;
@@ -81,6 +85,12 @@ namespace detail {
struct ZenCacheSessionState;
}
+struct ZenCacheResult
+{
+ IoBuffer Response;
+ bool Success = false;
+};
+
/** Zen Structured Cache session
*
* This provides a context in which cache queries can be performed
@@ -93,16 +103,13 @@ public:
ZenStructuredCacheSession(ZenStructuredCacheClient& OuterClient);
~ZenStructuredCacheSession();
- // Key-value cache operations
- IoBuffer Get(std::string_view BucketId, std::string_view Key);
- void Put(std::string_view BucketId, std::string_view Key, IoBuffer Data);
-
- // Structured cache operations
- IoBuffer Get(std::string_view BucketId, const IoHash& Key);
- IoBuffer Get(std::string_view BucketId, const IoHash& Key, const IoHash& ContentId);
- void Put(std::string_view BucketId, const IoHash& Key, ZenCacheValue Data);
+ ZenCacheResult GetCacheRecord(std::string_view BucketId, const IoHash& Key, ZenContentType Type);
+ ZenCacheResult GetCachePayload(std::string_view BucketId, const IoHash& Key, const IoHash& PayloadId);
+ ZenCacheResult PutCacheRecord(std::string_view BucketId, const IoHash& Key, IoBuffer Value, ZenContentType Type);
+ ZenCacheResult PutCachePayload(std::string_view BucketId, const IoHash& Key, const IoHash& PayloadId, IoBuffer Payload);
private:
+ spdlog::logger& m_Log;
ZenStructuredCacheClient& m_Client;
detail::ZenCacheSessionState* m_SessionState;
};
@@ -118,6 +125,8 @@ public:
ZenStructuredCacheClient(std::string_view ServiceUrl);
~ZenStructuredCacheClient();
+ std::string_view ServiceUrl() const { return m_ServiceUrl; }
+
private:
std::string m_ServiceUrl;