aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/structuredcachestore.h
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-10 13:12:02 +0200
committerGitHub <[email protected]>2023-10-10 13:12:02 +0200
commit7df585a13cd8d445396bbfbc10ad127dce89b272 (patch)
tree32da843f1f032504a8c8de0127f735fef53c8619 /src/zenserver/cache/structuredcachestore.h
parentfixed GC logging output stats (#458) (diff)
downloadzen-7df585a13cd8d445396bbfbc10ad127dce89b272.tar.xz
zen-7df585a13cd8d445396bbfbc10ad127dce89b272.zip
cache reference tracking (#455)
- Feature: Add caching of referenced CId content for structured cache records, this avoid disk thrashing when gathering references for GC - disabled by default, enable with `--cache-reference-cache-enabled` - Improvement: Faster collection of referenced CId content in project store
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.h')
-rw-r--r--src/zenserver/cache/structuredcachestore.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/zenserver/cache/structuredcachestore.h b/src/zenserver/cache/structuredcachestore.h
index eca2f1880..672858fa0 100644
--- a/src/zenserver/cache/structuredcachestore.h
+++ b/src/zenserver/cache/structuredcachestore.h
@@ -81,11 +81,12 @@ public:
ZenCacheNamespace(GcManager& Gc,
JobQueue& JobQueue,
const std::filesystem::path& RootDir,
+ bool EnableReferenceCaching,
const ZenCacheMemoryLayer::Configuration MemLayerConfig = {});
~ZenCacheNamespace();
bool Get(std::string_view Bucket, const IoHash& HashKey, ZenCacheValue& OutValue);
- void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value);
+ void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value, std::span<IoHash> References);
bool DropBucket(std::string_view Bucket);
void EnumerateBucketContents(std::string_view Bucket,
@@ -144,6 +145,7 @@ public:
{
std::filesystem::path BasePath;
bool AllowAutomaticCreationOfNamespaces = false;
+ bool EnableReferenceCaching = false;
ZenCacheMemoryLayer::Configuration MemLayerConfig;
struct LogConfig
{
@@ -191,7 +193,8 @@ public:
std::string_view Namespace,
std::string_view Bucket,
const IoHash& HashKey,
- const ZenCacheValue& Value);
+ const ZenCacheValue& Value,
+ std::span<IoHash> References);
bool DropBucket(std::string_view Namespace, std::string_view Bucket);
bool DropNamespace(std::string_view Namespace);
void Flush();