aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-09-11 09:21:50 -0400
committerGitHub <[email protected]>2023-09-11 15:21:50 +0200
commit4d54de153862bfe21997afe83195b879de01e749 (patch)
tree900104616727d41af93e4825b80f0ff2e953e71c /src
parentbetter sorting of attachments in oplog blocks (#390) (diff)
downloadzen-4d54de153862bfe21997afe83195b879de01e749.tar.xz
zen-4d54de153862bfe21997afe83195b879de01e749.zip
add `cache-write-log` and `cache-access-log“ configuration options (#394)
* add `cache-write-log` and `cache-access-log“ configuration options
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/cache/httpstructuredcache.cpp2
-rw-r--r--src/zenserver/config.cpp16
-rw-r--r--src/zenserver/config.h16
-rw-r--r--src/zenserver/zenserver.cpp9
4 files changed, 33 insertions, 10 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp
index 9b7ec61d7..9bc8d865a 100644
--- a/src/zenserver/cache/httpstructuredcache.cpp
+++ b/src/zenserver/cache/httpstructuredcache.cpp
@@ -705,6 +705,8 @@ HttpStructuredCacheService::HandleCacheRequest(HttpServerRequest& Request)
BasePathString << Info.Config.BasePath.u8string();
ResponseWriter.AddString("BasePath"sv, BasePathString.ToView());
ResponseWriter.AddBool("AllowAutomaticCreationOfNamespaces", Info.Config.AllowAutomaticCreationOfNamespaces);
+ ResponseWriter.AddBool("EnableWriteLog", Info.Config.EnableWriteLog);
+ ResponseWriter.AddBool("EnableAccessLog", Info.Config.EnableAccessLog);
}
ResponseWriter.EndObject();
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp
index 1f5a3eb21..7ec3a0cee 100644
--- a/src/zenserver/config.cpp
+++ b/src/zenserver/config.cpp
@@ -804,6 +804,8 @@ ParseConfigFile(const std::filesystem::path& Path,
////// cache
LuaOptions.AddOption("cache.enable"sv, ServerOptions.StructuredCacheEnabled);
+ LuaOptions.AddOption("cache.writelog"sv, ServerOptions.StructuredCacheWriteLogEnabled);
+ LuaOptions.AddOption("cache.accesslog"sv, ServerOptions.StructuredCacheAccessLogEnabled);
////// cache.upstream
LuaOptions.AddOption("cache.upstream.policy"sv, ServerOptions.UpstreamCacheConfig.CachePolicy, "upstream-cache-policy"sv);
@@ -1188,6 +1190,20 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.HordeConfig.Url)->default_value(""),
"");
+ options.add_option("cache",
+ "",
+ "cache-write-log",
+ "Whether cache write log is enabled",
+ cxxopts::value<bool>(ServerOptions.StructuredCacheWriteLogEnabled)->default_value("true"),
+ "");
+
+ options.add_option("cache",
+ "",
+ "cache-access-log",
+ "Whether cache access log is enabled",
+ cxxopts::value<bool>(ServerOptions.StructuredCacheAccessLogEnabled)->default_value("true"),
+ "");
+
options.add_option("compute",
"",
"upstream-horde-oauth-url",
diff --git a/src/zenserver/config.h b/src/zenserver/config.h
index 4f63e2644..0bb20aba4 100644
--- a/src/zenserver/config.h
+++ b/src/zenserver/config.h
@@ -139,13 +139,15 @@ struct ZenServerOptions
bool IsTest = false;
bool IsDedicated = false; // Indicates a dedicated/shared instance, with larger resource requirements
bool StructuredCacheEnabled = true;
- bool ExecServiceEnabled = true;
- bool ComputeServiceEnabled = true;
- bool ShouldCrash = false; // Option for testing crash handling
- bool IsFirstRun = false;
- bool NoSentry = false;
- bool SentryAllowPII = false; // Allow personally identifiable information in sentry crash reports
- bool ObjectStoreEnabled = false;
+ bool StructuredCacheWriteLogEnabled = false;
+ bool StructuredCacheAccessLogEnabled = false;
+ bool ExecServiceEnabled = true;
+ bool ComputeServiceEnabled = true;
+ bool ShouldCrash = false; // Option for testing crash handling
+ bool IsFirstRun = false;
+ bool NoSentry = false;
+ bool SentryAllowPII = false; // Allow personally identifiable information in sentry crash reports
+ bool ObjectStoreEnabled = false;
#if ZEN_WITH_TRACE
std::string TraceHost; // Host name or IP address to send trace data to
std::string TraceFile; // Path of a file to write a trace
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index 0d34e8d27..b8831476d 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -870,9 +870,12 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
using namespace std::literals;
ZEN_INFO("instantiating structured cache service");
- m_CacheStore = std::make_unique<ZenCacheStore>(
- m_GcManager,
- ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache", .AllowAutomaticCreationOfNamespaces = true});
+ m_CacheStore =
+ std::make_unique<ZenCacheStore>(m_GcManager,
+ ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache",
+ .AllowAutomaticCreationOfNamespaces = true,
+ .EnableWriteLog = ServerOptions.StructuredCacheWriteLogEnabled,
+ .EnableAccessLog = ServerOptions.StructuredCacheAccessLogEnabled});
const ZenUpstreamCacheConfig& UpstreamConfig = ServerOptions.UpstreamCacheConfig;