aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-18 21:53:59 +0200
committerGitHub <[email protected]>2023-10-18 21:53:59 +0200
commit6db4b4d1e023f4c17f12cb0915e0552f21d705f7 (patch)
treea380f15a653be4dc273eefaca1599467a7866b6e /src/zenserver/cache/structuredcachestore.cpp
parent0.2.28 (diff)
downloadzen-6db4b4d1e023f4c17f12cb0915e0552f21d705f7.tar.xz
zen-6db4b4d1e023f4c17f12cb0915e0552f21d705f7.zip
add `flush` command and more gc status info (#483)
- Feature: New endpoint `/admin/flush ` to flush all storage - CAS, Cache and ProjectStore - Feature: New command `zen flush` to flush all storage - CAS, Cache and ProjectStore - Improved: Command `zen gc-status` now gives details about storage, when last GC occured, how long until next GC etc - Changed: Cache access and write log are disabled by default
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
-rw-r--r--src/zenserver/cache/structuredcachestore.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp
index 48463fcd8..05b4c2e58 100644
--- a/src/zenserver/cache/structuredcachestore.cpp
+++ b/src/zenserver/cache/structuredcachestore.cpp
@@ -278,8 +278,7 @@ ZenCacheStore::ZenCacheStore(GcManager& Gc,
JobQueue& JobQueue,
const Configuration& Configuration,
const DiskWriteBlocker* InDiskWriteBlocker)
-: m_Log(logging::Get("z$"))
-, m_DiskWriteBlocker(InDiskWriteBlocker)
+: m_DiskWriteBlocker(InDiskWriteBlocker)
, m_Gc(Gc)
, m_JobQueue(JobQueue)
, m_Configuration(Configuration)
@@ -288,7 +287,7 @@ ZenCacheStore::ZenCacheStore(GcManager& Gc,
SetLoggingConfig(m_Configuration.Logging);
CreateDirectories(m_Configuration.BasePath);
- ZEN_INFO("Initializing at '{}'", m_Configuration.BasePath);
+ ZEN_INFO("initializing cache store at '{}'", m_Configuration.BasePath);
DirectoryContent DirContent;
GetDirectoryContent(m_Configuration.BasePath, DirectoryContent::IncludeDirsFlag, DirContent);
@@ -329,6 +328,7 @@ ZenCacheStore::ZenCacheStore(GcManager& Gc,
ZenCacheStore::~ZenCacheStore()
{
+ ZEN_INFO("closing cache store at '{}'", m_Configuration.BasePath);
SetLoggingConfig({.EnableWriteLog = false, .EnableAccessLog = false});
m_Namespaces.clear();
}
@@ -338,6 +338,10 @@ ZenCacheStore::LogWorker()
{
SetCurrentThreadName("ZenCacheStore::LogWorker");
+ spdlog::logger& ZCacheLog(logging::Get("z$"));
+
+ auto Log = [&ZCacheLog]() { return ZCacheLog; };
+
std::vector<AccessLogItem> Items;
while (true)
{
@@ -556,6 +560,7 @@ ZenCacheStore::DropNamespace(std::string_view InNamespace)
void
ZenCacheStore::Flush()
{
+ ZEN_INFO("flushing cache store at '{}'", m_Configuration.BasePath);
IterateNamespaces([&](std::string_view, ZenCacheNamespace& Store) { Store.Flush(); });
}