diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-06-11 13:24:18 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-06-11 13:24:51 +0000 |
commit | 714a924518bc5bef4f920899d3af96b56497eaf0 (patch) | |
tree | 6cea53d7a64aedeb4efda6680487dd5e9dc0f26c /configd | |
parent | d32a461a49354922d81e55aabddbd13cc8902c30 (diff) |
keep naming convention
Diffstat (limited to 'configd')
-rw-r--r-- | configd/src/apps/sentinel/CMakeLists.txt | 2 | ||||
-rw-r--r-- | configd/src/apps/sentinel/config-owner.cpp | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/config-owner.h | 2 | ||||
-rw-r--r-- | configd/src/apps/sentinel/env.cpp | 10 | ||||
-rw-r--r-- | configd/src/apps/sentinel/env.h | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/model-owner.cpp (renamed from configd/src/apps/sentinel/model-subscriber.cpp) | 14 | ||||
-rw-r--r-- | configd/src/apps/sentinel/model-owner.h (renamed from configd/src/apps/sentinel/model-subscriber.h) | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/report-connectivity.cpp | 4 | ||||
-rw-r--r-- | configd/src/apps/sentinel/report-connectivity.h | 4 | ||||
-rw-r--r-- | configd/src/apps/sentinel/rpchooks.cpp | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/rpchooks.h | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/rpcserver.cpp | 4 | ||||
-rw-r--r-- | configd/src/apps/sentinel/rpcserver.h | 4 |
13 files changed, 37 insertions, 37 deletions
diff --git a/configd/src/apps/sentinel/CMakeLists.txt b/configd/src/apps/sentinel/CMakeLists.txt index 3818f334ff2..0323df2864f 100644 --- a/configd/src/apps/sentinel/CMakeLists.txt +++ b/configd/src/apps/sentinel/CMakeLists.txt @@ -9,7 +9,7 @@ vespa_add_executable(configd_config-sentinel_app line-splitter.cpp manager.cpp metrics.cpp - model-subscriber.cpp + model-owner.cpp output-connection.cpp outward-check.cpp peer-check.cpp diff --git a/configd/src/apps/sentinel/config-owner.cpp b/configd/src/apps/sentinel/config-owner.cpp index 074f7187537..4042eded24e 100644 --- a/configd/src/apps/sentinel/config-owner.cpp +++ b/configd/src/apps/sentinel/config-owner.cpp @@ -18,7 +18,7 @@ void ConfigOwner::subscribe(const std::string & configId, std::chrono::milliseconds timeout) { _sentinelHandle = _subscriber.subscribe<SentinelConfig>(configId, timeout); try { - _modelHandle =_modelSubscriber.subscribe<ModelConfig>("admin/model", timeout); + _modelHandle =_modelOwner.subscribe<ModelConfig>("admin/model", timeout); } catch (ConfigTimeoutException & ex) { LOG(warning, "Timeout getting model config: %s [skipping connectivity checks]", ex.getMessage().c_str()); } catch (InvalidConfigException& ex) { @@ -54,10 +54,10 @@ ConfigOwner::checkForConfigUpdate() { std::optional<ModelConfig> ConfigOwner::getModelConfig() { - if (_modelHandle && _modelSubscriber.nextGenerationNow()) { + if (_modelHandle && _modelOwner.nextGenerationNow()) { if (auto newModel = _modelHandle->getConfig()) { LOG(config, "Sentinel got model info [version %s] for %zd hosts [config generation %" PRId64 "]", - newModel->vespaVersion.c_str(), newModel->hosts.size(), _modelSubscriber.getGeneration()); + newModel->vespaVersion.c_str(), newModel->hosts.size(), _modelOwner.getGeneration()); _modelConfig = std::move(newModel); } } diff --git a/configd/src/apps/sentinel/config-owner.h b/configd/src/apps/sentinel/config-owner.h index 7b79f65b1de..b27c515e357 100644 --- a/configd/src/apps/sentinel/config-owner.h +++ b/configd/src/apps/sentinel/config-owner.h @@ -26,7 +26,7 @@ private: int64_t _currGeneration = -1; std::unique_ptr<SentinelConfig> _currConfig; - ConfigSubscriber _modelSubscriber; + ConfigSubscriber _modelOwner; ConfigHandle<ModelConfig>::UP _modelHandle; std::unique_ptr<ModelConfig> _modelConfig; diff --git a/configd/src/apps/sentinel/env.cpp b/configd/src/apps/sentinel/env.cpp index 58b917ca16e..3fd9849023d 100644 --- a/configd/src/apps/sentinel/env.cpp +++ b/configd/src/apps/sentinel/env.cpp @@ -36,7 +36,7 @@ constexpr int maxConnectivityRetries = 100; Env::Env() : _cfgOwner(), - _modelSubscriber("admin/model"), + _modelOwner("admin/model"), _rpcCommandQueue(), _rpcServer(), _stateApi(), @@ -53,7 +53,7 @@ Env::~Env() = default; void Env::boot(const std::string &configId) { LOG(debug, "Reading configuration for ID: %s", configId.c_str()); _cfgOwner.subscribe(configId, CONFIG_TIMEOUT_MS); - _modelSubscriber.start(CONFIG_TIMEOUT_MS); + _modelOwner.start(CONFIG_TIMEOUT_MS); // subscribe() should throw if something is not OK Connectivity checker; for (int retry = 0; retry < maxConnectivityRetries; ++retry) { @@ -66,7 +66,7 @@ void Env::boot(const std::string &configId) { configId.c_str(), cfg.port.telnet, cfg.port.rpc); rpcPort(cfg.port.rpc); statePort(cfg.port.telnet); - auto model = _modelSubscriber.getModelConfig(); + auto model = _modelOwner.getModelConfig(); if (model.has_value()) { checker.configure(cfg.connectivity, model.value()); } @@ -99,7 +99,7 @@ void Env::rpcPort(int port) { if (_rpcServer && port == _rpcServer->getPort()) { return; // ok already } - _rpcServer = std::make_unique<RpcServer>(port, _rpcCommandQueue, _modelSubscriber); + _rpcServer = std::make_unique<RpcServer>(port, _rpcCommandQueue, _modelOwner); } void Env::statePort(int port) { @@ -121,7 +121,7 @@ void Env::statePort(int port) { void Env::notifyConfigUpdated() { vespalib::ComponentConfigProducer::Config current("sentinel", _cfgOwner.getGeneration(), "ok"); _stateApi.myComponents.addConfig(current); - _modelSubscriber.checkForUpdates(); + _modelOwner.checkForUpdates(); } void Env::respondAsEmpty() { diff --git a/configd/src/apps/sentinel/env.h b/configd/src/apps/sentinel/env.h index 9319caa4bd2..1bd3a7380ba 100644 --- a/configd/src/apps/sentinel/env.h +++ b/configd/src/apps/sentinel/env.h @@ -5,7 +5,7 @@ #include "cmdq.h" #include "config-owner.h" #include "metrics.h" -#include "model-subscriber.h" +#include "model-owner.h" #include "rpcserver.h" #include "state-api.h" #include <vespa/vespalib/net/state_server.h> @@ -23,7 +23,7 @@ public: ~Env(); ConfigOwner &configOwner() { return _cfgOwner; } - ModelSubscriber &modelSubscriber() { return _modelSubscriber; } + ModelOwner &modelOwner() { return _modelOwner; } CommandQueue &commandQueue() { return _rpcCommandQueue; } StartMetrics &metrics() { return _startMetrics; } @@ -35,7 +35,7 @@ public: private: void respondAsEmpty(); ConfigOwner _cfgOwner; - ModelSubscriber _modelSubscriber; + ModelOwner _modelOwner; CommandQueue _rpcCommandQueue; std::unique_ptr<RpcServer> _rpcServer; StateApi _stateApi; diff --git a/configd/src/apps/sentinel/model-subscriber.cpp b/configd/src/apps/sentinel/model-owner.cpp index f603b5fcb1b..601a57e16c9 100644 --- a/configd/src/apps/sentinel/model-subscriber.cpp +++ b/configd/src/apps/sentinel/model-owner.cpp @@ -1,19 +1,19 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "model-subscriber.h" +#include "model-owner.h" #include <vespa/vespalib/util/exceptions.h> #include <vespa/config/common/exceptions.h> #include <string> #include <chrono> #include <vespa/log/log.h> -LOG_SETUP(".sentinel.model-subscriber"); +LOG_SETUP(".sentinel.model-owner"); using namespace std::chrono_literals; namespace config::sentinel { -std::optional<ModelConfig> ModelSubscriber::getModelConfig() { +std::optional<ModelConfig> ModelOwner::getModelConfig() { checkForUpdates(); if (_modelConfig) { return ModelConfig(*_modelConfig); @@ -23,14 +23,14 @@ std::optional<ModelConfig> ModelSubscriber::getModelConfig() { } -ModelSubscriber::ModelSubscriber(const std::string &configId) +ModelOwner::ModelOwner(const std::string &configId) : _configId(configId) {} -ModelSubscriber::~ModelSubscriber() = default; +ModelOwner::~ModelOwner() = default; void -ModelSubscriber::start(std::chrono::milliseconds timeout) { +ModelOwner::start(std::chrono::milliseconds timeout) { try { _modelHandle =_subscriber.subscribe<ModelConfig>(_configId, timeout); } catch (ConfigTimeoutException & ex) { @@ -43,7 +43,7 @@ ModelSubscriber::start(std::chrono::milliseconds timeout) { } void -ModelSubscriber::checkForUpdates() { +ModelOwner::checkForUpdates() { if (! _modelHandle) { start(5ms); } diff --git a/configd/src/apps/sentinel/model-subscriber.h b/configd/src/apps/sentinel/model-owner.h index 1777e287d4f..d03e7dec06d 100644 --- a/configd/src/apps/sentinel/model-subscriber.h +++ b/configd/src/apps/sentinel/model-owner.h @@ -13,15 +13,15 @@ namespace config::sentinel { /** * Handles config subscription and has a snapshot of current config. **/ -class ModelSubscriber { +class ModelOwner { private: std::string _configId; config::ConfigSubscriber _subscriber; config::ConfigHandle<ModelConfig>::UP _modelHandle; std::unique_ptr<ModelConfig> _modelConfig; public: - ModelSubscriber(const std::string &configId); - virtual ~ModelSubscriber(); + ModelOwner(const std::string &configId); + virtual ~ModelOwner(); void start(std::chrono::milliseconds timeout); void checkForUpdates(); std::optional<ModelConfig> getModelConfig(); diff --git a/configd/src/apps/sentinel/report-connectivity.cpp b/configd/src/apps/sentinel/report-connectivity.cpp index a98bbdc0eec..4b5d38ed125 100644 --- a/configd/src/apps/sentinel/report-connectivity.cpp +++ b/configd/src/apps/sentinel/report-connectivity.cpp @@ -14,12 +14,12 @@ using namespace std::chrono_literals; namespace config::sentinel { -ReportConnectivity::ReportConnectivity(FRT_RPCRequest *req, FRT_Supervisor &orb, ModelSubscriber &modelSubscriber) +ReportConnectivity::ReportConnectivity(FRT_RPCRequest *req, FRT_Supervisor &orb, ModelOwner &modelOwner) : _parentRequest(req), _orb(orb), _checks() { - auto cfg = modelSubscriber.getModelConfig(); + auto cfg = modelOwner.getModelConfig(); if (cfg.has_value()) { auto map = Connectivity::specsFrom(cfg.value()); LOG(debug, "making connectivity report for %zd peers", map.size()); diff --git a/configd/src/apps/sentinel/report-connectivity.h b/configd/src/apps/sentinel/report-connectivity.h index 19b2d74fce1..b7b8100c6fa 100644 --- a/configd/src/apps/sentinel/report-connectivity.h +++ b/configd/src/apps/sentinel/report-connectivity.h @@ -6,7 +6,7 @@ #include <vespa/fnet/frt/supervisor.h> #include <vespa/config-model.h> #include <vespa/config/helper/configfetcher.h> -#include "model-subscriber.h" +#include "model-owner.h" #include "peer-check.h" #include "status-callback.h" @@ -20,7 +20,7 @@ namespace config::sentinel { class ReportConnectivity : public StatusCallback { public: - ReportConnectivity(FRT_RPCRequest *req, FRT_Supervisor &orb, ModelSubscriber &modelSubscriber); + ReportConnectivity(FRT_RPCRequest *req, FRT_Supervisor &orb, ModelOwner &modelOwner); virtual ~ReportConnectivity(); void returnStatus(bool ok) override; private: diff --git a/configd/src/apps/sentinel/rpchooks.cpp b/configd/src/apps/sentinel/rpchooks.cpp index a8d0240e6e8..603fb461fe2 100644 --- a/configd/src/apps/sentinel/rpchooks.cpp +++ b/configd/src/apps/sentinel/rpchooks.cpp @@ -13,10 +13,10 @@ LOG_SETUP(".rpchooks"); namespace config::sentinel { -RPCHooks::RPCHooks(CommandQueue &commands, FRT_Supervisor &supervisor, ModelSubscriber &modelSubscriber) +RPCHooks::RPCHooks(CommandQueue &commands, FRT_Supervisor &supervisor, ModelOwner &modelOwner) : _commands(commands), _orb(supervisor), - _modelSubscriber(modelSubscriber) + _modelOwner(modelOwner) { initRPC(&_orb); } @@ -119,7 +119,7 @@ RPCHooks::rpc_reportConnectivity(FRT_RPCRequest *req) { LOG(debug, "got reportConnectivity"); req->Detach(); - req->getStash().create<ReportConnectivity>(req, _orb, _modelSubscriber); + req->getStash().create<ReportConnectivity>(req, _orb, _modelOwner); } } // namespace slobrok diff --git a/configd/src/apps/sentinel/rpchooks.h b/configd/src/apps/sentinel/rpchooks.h index badfd560034..292e8198b55 100644 --- a/configd/src/apps/sentinel/rpchooks.h +++ b/configd/src/apps/sentinel/rpchooks.h @@ -2,7 +2,7 @@ #pragma once -#include "model-subscriber.h" +#include "model-owner.h" #include <vespa/fnet/frt/invokable.h> #include <memory> @@ -26,9 +26,9 @@ class RPCHooks : public FRT_Invokable private: CommandQueue &_commands; FRT_Supervisor &_orb; - ModelSubscriber &_modelSubscriber; + ModelOwner &_modelOwner; public: - RPCHooks(CommandQueue &commands, FRT_Supervisor &supervisor, ModelSubscriber &modelSubscriber); + RPCHooks(CommandQueue &commands, FRT_Supervisor &supervisor, ModelOwner &modelOwner); ~RPCHooks() override; private: void initRPC(FRT_Supervisor *supervisor); diff --git a/configd/src/apps/sentinel/rpcserver.cpp b/configd/src/apps/sentinel/rpcserver.cpp index 18b0dfc3630..be867ae95db 100644 --- a/configd/src/apps/sentinel/rpcserver.cpp +++ b/configd/src/apps/sentinel/rpcserver.cpp @@ -7,9 +7,9 @@ LOG_SETUP(".rpcserver"); namespace config::sentinel { -RpcServer::RpcServer(int portNumber, CommandQueue &cmdQ, ModelSubscriber &modelSubscriber) +RpcServer::RpcServer(int portNumber, CommandQueue &cmdQ, ModelOwner &modelOwner) : _server(), - _rpcHooks(cmdQ, _server.supervisor(), modelSubscriber), + _rpcHooks(cmdQ, _server.supervisor(), modelOwner), _port(portNumber) { if (_server.supervisor().Listen(portNumber)) { diff --git a/configd/src/apps/sentinel/rpcserver.h b/configd/src/apps/sentinel/rpcserver.h index e2c7caaacb1..8f60acce1ca 100644 --- a/configd/src/apps/sentinel/rpcserver.h +++ b/configd/src/apps/sentinel/rpcserver.h @@ -5,7 +5,7 @@ #include <memory> #include "cmdq.h" -#include "model-subscriber.h" +#include "model-owner.h" #include "rpchooks.h" #include <vespa/fnet/frt/supervisor.h> @@ -19,7 +19,7 @@ private: int _port; public: - RpcServer(int port, CommandQueue &cmdQ, ModelSubscriber &modelSubscriber); + RpcServer(int port, CommandQueue &cmdQ, ModelOwner &modelOwner); ~RpcServer(); int getPort() const { return _port; } |