diff options
| author | Per Larsson <[email protected]> | 2021-09-17 17:03:17 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-17 17:03:17 +0200 |
| commit | a4527dda7b39de637f420f458462024796c2cd14 (patch) | |
| tree | e66775ef1a399c96dc858f190180eb4b04bb3ede /zenserver/zenserver.cpp | |
| parent | Added cache policy tests for CbPackage. (diff) | |
| download | zen-a4527dda7b39de637f420f458462024796c2cd14.tar.xz zen-a4527dda7b39de637f420f458462024796c2cd14.zip | |
Added upstream cache policy command line option (read|write,readonly,writeonly,disabled).
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index eb0324161..63e94ab7d 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -11,9 +11,9 @@ #include <zencore/timer.h> #include <zencore/windows.h> #include <zenhttp/httpserver.h> -#include <zenutil/zenserverprocess.h> #include <zenstore/cas.h> #include <zenstore/cidstore.h> +#include <zenutil/zenserverprocess.h> #include <fmt/format.h> #include <mimalloc-new-delete.h> @@ -162,11 +162,15 @@ public: m_CacheStore = std::make_unique<ZenCacheStore>(*m_CasStore, m_DataRoot / "cache"); std::unique_ptr<zen::UpstreamCache> UpstreamCache; - if (ServiceConfig.UpstreamCacheConfig.Enabled) + if (ServiceConfig.UpstreamCacheConfig.CachePolicy != UpstreamCachePolicy::Disabled) { const ZenUpstreamCacheConfig& UpstreamConfig = ServiceConfig.UpstreamCacheConfig; zen::UpstreamCacheOptions UpstreamOptions; + UpstreamOptions.ReadUpstream = + (uint8_t(ServiceConfig.UpstreamCacheConfig.CachePolicy) & uint8_t(UpstreamCachePolicy::Read)) != 0; + UpstreamOptions.WriteUpstream = + (uint8_t(ServiceConfig.UpstreamCacheConfig.CachePolicy) & uint8_t(UpstreamCachePolicy::Write)) != 0; if (UpstreamConfig.UpstreamThreadCount < 32) { @@ -212,7 +216,11 @@ public: if (UpstreamCache->Initialize()) { - ZEN_INFO("upstream cache active"); + ZEN_INFO("upstream cache active ({})", + UpstreamOptions.ReadUpstream && UpstreamOptions.WriteUpstream ? "READ|WRITE" + : UpstreamOptions.ReadUpstream ? "READONLY" + : UpstreamOptions.WriteUpstream ? "WRITEONLY" + : "DISABLED"); } else { @@ -422,7 +430,7 @@ private: bool m_DebugOptionForcedCrash = false; }; -} +} // namespace zen int main(int argc, char* argv[]) |