aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-20 11:02:26 +0200
committerGitHub <[email protected]>2023-10-20 11:02:26 +0200
commit57f054be2f4f68d0d52631838655a45855c33655 (patch)
tree4a768d8eee548c1c4c002388e48da3d62850dc02 /src/zenserver
parentAdd --skip-delete option to gc command (#484) (diff)
downloadzen-57f054be2f4f68d0d52631838655a45855c33655.tar.xz
zen-57f054be2f4f68d0d52631838655a45855c33655.zip
clean up GcContributor and GcStorage to be pure interfaces (#485)
Diffstat (limited to 'src/zenserver')
-rw-r--r--src/zenserver/cache/structuredcachestore.cpp8
-rw-r--r--src/zenserver/cache/structuredcachestore.h1
-rw-r--r--src/zenserver/projectstore/projectstore.cpp9
-rw-r--r--src/zenserver/projectstore/projectstore.h1
4 files changed, 14 insertions, 5 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp
index 05b4c2e58..786053adc 100644
--- a/src/zenserver/cache/structuredcachestore.cpp
+++ b/src/zenserver/cache/structuredcachestore.cpp
@@ -63,8 +63,7 @@ ZenCacheNamespace::ZenCacheNamespace(GcManager& Gc,
const std::filesystem::path& RootDir,
bool EnableReferenceCaching,
const ZenCacheMemoryLayer::Configuration MemLayerConfig)
-: GcStorage(Gc)
-, GcContributor(Gc)
+: m_Gc(Gc)
, m_RootDir(RootDir)
, m_JobQueue(JobQueue)
, m_MemLayer(m_JobQueue, MemLayerConfig)
@@ -74,10 +73,15 @@ ZenCacheNamespace::ZenCacheNamespace(GcManager& Gc,
CreateDirectories(RootDir);
m_DiskLayer.DiscoverBuckets();
+
+ m_Gc.AddGcContributor(this);
+ m_Gc.AddGcStorage(this);
}
ZenCacheNamespace::~ZenCacheNamespace()
{
+ m_Gc.RemoveGcStorage(this);
+ m_Gc.RemoveGcContributor(this);
}
bool
diff --git a/src/zenserver/cache/structuredcachestore.h b/src/zenserver/cache/structuredcachestore.h
index c67b23e93..28b2189ae 100644
--- a/src/zenserver/cache/structuredcachestore.h
+++ b/src/zenserver/cache/structuredcachestore.h
@@ -112,6 +112,7 @@ public:
CacheValueDetails::NamespaceDetails GetValueDetails(const std::string_view BucketFilter, const std::string_view ValueFilter) const;
private:
+ GcManager& m_Gc;
std::filesystem::path m_RootDir;
JobQueue& m_JobQueue;
ZenCacheMemoryLayer m_MemLayer;
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 0010f09f5..430d5f693 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1664,9 +1664,8 @@ ProjectStore::Project::TouchOplog(std::string_view Oplog) const
//////////////////////////////////////////////////////////////////////////
ProjectStore::ProjectStore(CidStore& Store, std::filesystem::path BasePath, GcManager& Gc, JobQueue& JobQueue)
-: GcStorage(Gc)
-, GcContributor(Gc)
-, m_Log(logging::Get("project"))
+: m_Log(logging::Get("project"))
+, m_Gc(Gc)
, m_CidStore(Store)
, m_JobQueue(JobQueue)
, m_ProjectBasePath(BasePath)
@@ -1674,11 +1673,15 @@ ProjectStore::ProjectStore(CidStore& Store, std::filesystem::path BasePath, GcMa
{
ZEN_INFO("initializing project store at '{}'", m_ProjectBasePath);
// m_Log.set_level(spdlog::level::debug);
+ m_Gc.AddGcContributor(this);
+ m_Gc.AddGcStorage(this);
}
ProjectStore::~ProjectStore()
{
ZEN_INFO("closing project store at '{}'", m_ProjectBasePath);
+ m_Gc.RemoveGcStorage(this);
+ m_Gc.RemoveGcContributor(this);
}
std::filesystem::path
diff --git a/src/zenserver/projectstore/projectstore.h b/src/zenserver/projectstore/projectstore.h
index 0ed9ef532..5aede88b0 100644
--- a/src/zenserver/projectstore/projectstore.h
+++ b/src/zenserver/projectstore/projectstore.h
@@ -361,6 +361,7 @@ public:
private:
spdlog::logger& m_Log;
+ GcManager& m_Gc;
CidStore& m_CidStore;
JobQueue& m_JobQueue;
std::filesystem::path m_ProjectBasePath;