aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/upstreamcache.h
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/upstream/upstreamcache.h')
-rw-r--r--zenserver/upstream/upstreamcache.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/zenserver/upstream/upstreamcache.h b/zenserver/upstream/upstreamcache.h
index edc995da6..04554f210 100644
--- a/zenserver/upstream/upstreamcache.h
+++ b/zenserver/upstream/upstreamcache.h
@@ -2,12 +2,15 @@
#pragma once
+#include "cache/cachekey.h"
+
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
#include <zencore/zencore.h>
#include <atomic>
#include <chrono>
+#include <functional>
#include <memory>
namespace zen {
@@ -62,6 +65,11 @@ struct GetUpstreamCacheResult
bool Success = false;
};
+struct GetUpstreamCacheBatchResult
+{
+ std::vector<size_t> Missing;
+};
+
struct PutUpstreamCacheResult
{
std::string Reason;
@@ -88,6 +96,8 @@ struct UpstreamEndpointStats
std::atomic<double> SecondsDown{};
};
+using OnCacheGetComplete = std::function<void(size_t, IoBuffer)>;
+
/**
* The upstream endpont is responsible for handling upload/downloading of cache records.
*/
@@ -129,6 +139,10 @@ public:
virtual GetUpstreamCacheResult GetCacheRecord(UpstreamCacheKey CacheKey, ZenContentType Type) = 0;
+ virtual GetUpstreamCacheBatchResult GetCacheRecords(std::span<CacheKey> CacheKeys,
+ std::span<size_t> KeyIndex,
+ OnCacheGetComplete OnComplete) = 0;
+
virtual GetUpstreamCacheResult GetCachePayload(UpstreamPayloadKey PayloadKey) = 0;
struct EnqueueResult