diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-20 23:26:55 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-20 23:34:51 +0000 |
commit | acbdc8385fef981a9bc5cbfb46483c54c953dc04 (patch) | |
tree | 1d9c02e4e9476510dd32131cad01940969493806 | |
parent | 1cfea65b9bc71b472e9dc3370b120cf428b6ece0 (diff) |
Make ConfigUri constructors explicit and use same context where possible in proton.
48 files changed, 137 insertions, 165 deletions
diff --git a/config/src/vespa/config/subscription/configuri.cpp b/config/src/vespa/config/subscription/configuri.cpp index edb06f8b237..07b3bd7a7e2 100644 --- a/config/src/vespa/config/subscription/configuri.cpp +++ b/config/src/vespa/config/subscription/configuri.cpp @@ -11,7 +11,7 @@ bool checkEmpty(const vespalib::string & configId) { } namespace config { -ConfigUri::ConfigUri(const vespalib::string &configId) +ConfigUri::ConfigUri(vespalib::stringref configId) : _configId(legacyConfigId2ConfigId(configId)), _context(std::make_shared<ConfigContext>(*legacyConfigId2Spec(configId))), _empty(checkEmpty(configId)) diff --git a/config/src/vespa/config/subscription/configuri.h b/config/src/vespa/config/subscription/configuri.h index d8472d9a637..d0743210416 100644 --- a/config/src/vespa/config/subscription/configuri.h +++ b/config/src/vespa/config/subscription/configuri.h @@ -17,29 +17,12 @@ class SourceSpec; */ class ConfigUri { public: - /** - * Construct a config URI from a given config id. - * @param configId The config id. - */ - ConfigUri(const char * configId) : ConfigUri(vespalib::string(configId)) {} - - /** - * Construct a config URI from a given config id. - * @param configId The config id. - */ - ConfigUri(const std::string &configId) : ConfigUri(vespalib::string(configId)) {} - - /** - * Construct a config URI from a given config id. - * @param configId The config id. - */ - ConfigUri(vespalib::stringref configId) : ConfigUri(vespalib::string(configId)) {} /** * Construct a config URI from a given config id. * @param configId The config id. */ - ConfigUri(const vespalib::string &configId); + explicit ConfigUri(vespalib::stringref configId); /** * Construct a config URI from a config id and a context. diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.cpp b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.cpp index a067610fb25..6763259c70d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.cpp @@ -23,7 +23,7 @@ RoutingPolicyFactories::AndPolicyFactory::createPolicy(const string ¶m) cons mbus::IRoutingPolicy::UP RoutingPolicyFactories::MessageTypePolicyFactory::createPolicy(const string ¶m) const { - return std::make_unique<MessageTypePolicy>(param); + return std::make_unique<MessageTypePolicy>(config::ConfigUri(param)); } mbus::IRoutingPolicy::UP @@ -61,7 +61,7 @@ DocumentRouteSelectorPolicyFactory(const document::DocumentTypeRepo &repo, mbus::IRoutingPolicy::UP RoutingPolicyFactories::DocumentRouteSelectorPolicyFactory::createPolicy(const string ¶m) const { - auto ret = std::make_unique<DocumentRouteSelectorPolicy>(_repo, param.empty() ? _configId : param); + auto ret = std::make_unique<DocumentRouteSelectorPolicy>(_repo, config::ConfigUri(param.empty() ? _configId : param)); string error = static_cast<DocumentRouteSelectorPolicy&>(*ret).getError(); if (!error.empty()) { return std::make_unique<ErrorPolicy>(error); @@ -72,10 +72,10 @@ RoutingPolicyFactories::DocumentRouteSelectorPolicyFactory::createPolicy(const s mbus::IRoutingPolicy::UP RoutingPolicyFactories::ExternPolicyFactory::createPolicy(const string ¶m) const { - mbus::IRoutingPolicy::UP ret(new ExternPolicy(param)); + auto ret = std::make_unique<ExternPolicy>(param); string error = static_cast<ExternPolicy&>(*ret).getError(); if (!error.empty()) { - ret.reset(new ErrorPolicy(error)); + return std::make_unique<ErrorPolicy>(error); } return ret; } diff --git a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp index 48c7b7e7298..a4cdd25040b 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetworkparams.cpp @@ -6,7 +6,7 @@ namespace mbus { RPCNetworkParams::RPCNetworkParams() - : RPCNetworkParams("client") + : RPCNetworkParams(config::ConfigUri("client")) { } RPCNetworkParams::RPCNetworkParams(config::ConfigUri configUri) : diff --git a/messagebus_test/src/tests/error/cpp-client.cpp b/messagebus_test/src/tests/error/cpp-client.cpp index 5cf88c10d64..365032536cc 100644 --- a/messagebus_test/src/tests/error/cpp-client.cpp +++ b/messagebus_test/src/tests/error/cpp-client.cpp @@ -23,9 +23,9 @@ int App::Main() { RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg") + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity("server/cpp")), - "file:routing.cfg"); + config::ConfigUri("file:routing.cfg")); Receptor src; Message::UP msg; diff --git a/messagebus_test/src/tests/error/cpp-server.cpp b/messagebus_test/src/tests/error/cpp-server.cpp index 2343eec7254..e6be163a366 100644 --- a/messagebus_test/src/tests/error/cpp-server.cpp +++ b/messagebus_test/src/tests/error/cpp-server.cpp @@ -52,9 +52,9 @@ int App::Main() { RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg") + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity("server/cpp")), - "file:routing.cfg"); + config::ConfigUri("file:routing.cfg")); Server server(mb.getMessageBus()); while (true) { std::this_thread::sleep_for(1s); diff --git a/messagebus_test/src/tests/speed/cpp-client.cpp b/messagebus_test/src/tests/speed/cpp-client.cpp index 385f983b7cb..d8ba5d85169 100644 --- a/messagebus_test/src/tests/speed/cpp-client.cpp +++ b/messagebus_test/src/tests/speed/cpp-client.cpp @@ -96,8 +96,8 @@ App::Main() auto retryPolicy = std::make_shared<RetryTransientErrorsPolicy>(); retryPolicy->setBaseDelay(0.1); RPCMessageBus mb(MessageBusParams().setRetryPolicy(retryPolicy).addProtocol(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg").setIdentity(Identity("server/cpp")), - "file:routing.cfg"); + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")).setIdentity(Identity("server/cpp")), + config::ConfigUri("file:routing.cfg")); Client client(mb.getMessageBus(), SourceSessionParams().setTimeout(30s)); // let the system 'warm up' diff --git a/messagebus_test/src/tests/speed/cpp-server.cpp b/messagebus_test/src/tests/speed/cpp-server.cpp index 8d6fa65f530..20a72596182 100644 --- a/messagebus_test/src/tests/speed/cpp-server.cpp +++ b/messagebus_test/src/tests/speed/cpp-server.cpp @@ -39,11 +39,11 @@ Server::handleMessage(Message::UP msg) { && (msg->getType() == SimpleProtocol::MESSAGE) && (static_cast<SimpleMessage&>(*msg).getValue() == "message")) { - Reply::UP reply(new SimpleReply("OK")); + auto reply = std::make_unique<SimpleReply>("OK"); msg->swapState(*reply); _session->reply(std::move(reply)); } else { - Reply::UP reply(new SimpleReply("FAIL")); + auto reply = std::make_unique<SimpleReply>("FAIL"); msg->swapState(*reply); _session->reply(std::move(reply)); } @@ -59,9 +59,9 @@ int App::Main() { RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg") + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity("server/cpp")), - "file:routing.cfg"); + config::ConfigUri("file:routing.cfg")); Server server(mb.getMessageBus()); while (true) { std::this_thread::sleep_for(1s); diff --git a/messagebus_test/src/tests/trace/cpp-server.cpp b/messagebus_test/src/tests/trace/cpp-server.cpp index 454c8b784eb..6d8d7501c79 100644 --- a/messagebus_test/src/tests/trace/cpp-server.cpp +++ b/messagebus_test/src/tests/trace/cpp-server.cpp @@ -41,7 +41,7 @@ Server::handleMessage(Message::UP msg) { msg->getTrace().trace(1, _name + " (message)", false); if (!msg->getRoute().hasHops()) { fprintf(stderr, "**** Server '%s' replying.\n", _name.c_str()); - Reply::UP reply(new EmptyReply()); + auto reply = std::make_unique<EmptyReply>(); msg->swapState(*reply); handleReply(std::move(reply)); } else { @@ -70,9 +70,9 @@ App::Main() return 1; } RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg") + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")) .setIdentity(Identity(_argv[1])), - "file:routing.cfg"); + config::ConfigUri("file:routing.cfg")); Server server(mb.getMessageBus(), _argv[1]); while (true) { std::this_thread::sleep_for(1s); diff --git a/messagebus_test/src/tests/trace/trace.cpp b/messagebus_test/src/tests/trace/trace.cpp index 28cda46f69e..5dfa702ca20 100644 --- a/messagebus_test/src/tests/trace/trace.cpp +++ b/messagebus_test/src/tests/trace/trace.cpp @@ -8,15 +8,11 @@ #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/sourcesession.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/intermediatesession.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/slobrok.h> #include <vespa/messagebus/testlib/testserver.h> #include <vespa/messagebus/routing/routingspec.h> #include <vespa/messagebus/testlib/receptor.h> #include <vespa/messagebus/sourcesessionparams.h> #include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <iostream> #include <thread> @@ -61,8 +57,8 @@ Test::Main() EXPECT_TRUE(system((ctl_script + " start all").c_str()) == 0); RPCMessageBus mb(ProtocolSet().add(std::make_shared<SimpleProtocol>()), - RPCNetworkParams("file:slobrok.cfg"), - "file:routing.cfg"); + RPCNetworkParams(config::ConfigUri("file:slobrok.cfg")), + config::ConfigUri("file:routing.cfg")); EXPECT_TRUE(waitSlobrok(mb, "server/cpp/1/A/session")); EXPECT_TRUE(waitSlobrok(mb, "server/cpp/2/A/session")); EXPECT_TRUE(waitSlobrok(mb, "server/cpp/2/B/session")); diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index cfc2e722732..6b69569f499 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -21,6 +21,7 @@ LOG_SETUP(".test.metricmanager"); using namespace vespalib::atomic; +using config::ConfigUri; namespace metrics { @@ -81,7 +82,7 @@ MultiSubMetricSet::MultiSubMetricSet(MetricSet* owner) sum.addMetricToSum(b); } -MultiSubMetricSet::~MultiSubMetricSet() { } +MultiSubMetricSet::~MultiSubMetricSet() = default; struct TestMetricSet { MetricSet set; @@ -114,7 +115,7 @@ TestMetricSet::TestMetricSet() val10(&set) { } -TestMetricSet::~TestMetricSet() { } +TestMetricSet::~TestMetricSet() = default; struct MetricNameVisitor : public MetricVisitor { @@ -155,7 +156,7 @@ getMatchedMetrics(const vespalib::string& config) TestMetricSet mySet; MetricManager mm; mm.registerMetric(mm.getMetricLock(), mySet.set); - mm.init(config, pool); + mm.init(ConfigUri(config), pool); MetricNameVisitor visitor; /** Take a copy to verify clone works. @@ -483,14 +484,14 @@ TEST_F(MetricManagerTest, test_snapshots) MetricLockGuard lockGuard(mm.getMetricLock()); mm.registerMetric(lockGuard, mySet.set); } - mm.init("raw:" - "consumer[2]\n" - "consumer[0].name snapper\n" - "consumer[0].tags[1]\n" - "consumer[0].tags[0] snaptest\n" - "consumer[1].name log\n" - "consumer[1].tags[1]\n" - "consumer[1].tags[0] snaptest\n", + mm.init(ConfigUri("raw:" + "consumer[2]\n" + "consumer[0].name snapper\n" + "consumer[0].tags[1]\n" + "consumer[0].tags[0] snaptest\n" + "consumer[1].name log\n" + "consumer[1].tags[1]\n" + "consumer[1].tags[0] snaptest\n"), pool); MetricNameVisitor visitor; { @@ -585,14 +586,14 @@ TEST_F(MetricManagerTest, test_xml_output) } // Initialize metric manager to get snapshots created. - mm.init("raw:" - "consumer[2]\n" - "consumer[0].name snapper\n" - "consumer[0].tags[1]\n" - "consumer[0].tags[0] snaptest\n" - "consumer[1].name log\n" - "consumer[1].tags[1]\n" - "consumer[1].tags[0] snaptest\n", + mm.init(ConfigUri("raw:" + "consumer[2]\n" + "consumer[0].name snapper\n" + "consumer[0].tags[1]\n" + "consumer[0].tags[0] snaptest\n" + "consumer[1].name log\n" + "consumer[1].tags[1]\n" + "consumer[1].tags[0] snaptest\n"), pool); takeSnapshots(mm, 1000); @@ -663,11 +664,11 @@ TEST_F(MetricManagerTest, test_json_output) } // Initialize metric manager to get snapshots created. - mm.init("raw:" - "consumer[1]\n" - "consumer[0].name snapper\n" - "consumer[0].tags[1]\n" - "consumer[0].tags[0] snaptest\n", + mm.init(ConfigUri("raw:" + "consumer[1]\n" + "consumer[0].name snapper\n" + "consumer[0].tags[1]\n" + "consumer[0].tags[0] snaptest\n"), pool); takeSnapshots(mm, 1000); @@ -762,12 +763,11 @@ struct MetricSnapshotTestFixture } // Initialize metric manager to get snapshots created. - manager.init( - "raw:" - "consumer[1]\n" - "consumer[0].name snapper\n" - "consumer[0].addedmetrics[1]\n" - "consumer[0].addedmetrics[0] *\n", + manager.init(ConfigUri("raw:" + "consumer[1]\n" + "consumer[0].name snapper\n" + "consumer[0].addedmetrics[1]\n" + "consumer[0].addedmetrics[0] *\n"), pool); test.takeSnapshots(manager, 1000); @@ -998,14 +998,14 @@ TEST_F(MetricManagerTest, test_text_output) mySet.val10.a.val2.addValue(2); mySet.val10.b.val1.addValue(1); // Initialize metric manager to get snapshots created. - mm.init("raw:" - "consumer[2]\n" - "consumer[0].name snapper\n" - "consumer[0].tags[1]\n" - "consumer[0].tags[0] snaptest\n" - "consumer[1].name log\n" - "consumer[1].tags[1]\n" - "consumer[1].tags[0] snaptest\n", + mm.init(ConfigUri("raw:" + "consumer[2]\n" + "consumer[0].name snapper\n" + "consumer[0].tags[1]\n" + "consumer[0].tags[0] snaptest\n" + "consumer[1].name log\n" + "consumer[1].tags[1]\n" + "consumer[1].tags[0] snaptest\n"), pool); std::string expected( "snapshot \"Active metrics showing updates since last snapshot\" from 1000 to 0 period 0\n" @@ -1102,14 +1102,14 @@ TEST_F(MetricManagerTest, test_update_hooks) // Initialize metric manager to get snapshots created. output << "Running init\n"; - mm.init("raw:" - "consumer[2]\n" - "consumer[0].name snapper\n" - "consumer[0].tags[1]\n" - "consumer[0].tags[0] snaptest\n" - "consumer[1].name log\n" - "consumer[1].tags[1]\n" - "consumer[1].tags[0] snaptest\n", + mm.init(ConfigUri("raw:" + "consumer[2]\n" + "consumer[0].name snapper\n" + "consumer[0].tags[1]\n" + "consumer[0].tags[0] snaptest\n" + "consumer[1].name log\n" + "consumer[1].tags[1]\n" + "consumer[1].tags[0] snaptest\n"), pool); output << "Init done\n"; diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp index 7215823e694..46b3b217c26 100644 --- a/metrics/src/tests/snapshottest.cpp +++ b/metrics/src/tests/snapshottest.cpp @@ -183,8 +183,9 @@ TEST_F(SnapshotTest, test_snapshot_two_days) MetricLockGuard lockGuard(mm.getMetricLock()); mm.registerMetric(lockGuard, set); } - mm.init("raw:consumer[1]\n" - "consumer[0].name \"log\"", threadPool, false); + mm.init(config::ConfigUri("raw:consumer[1]\n" + "consumer[0].name \"log\""), + threadPool, false); tick(mm, timer->_timeInSecs * 1000); for (uint32_t days=0; days<2; ++days) { diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index d7e073c9a56..61536f924a5 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -185,7 +185,9 @@ App::Main() LOG(debug, "identity: '%s'", params.identity.c_str()); LOG(debug, "serviceidentity: '%s'", params.serviceidentity.c_str()); LOG(debug, "subscribeTimeout: '%" PRIu64 "'", params.subscribeTimeout); - protonUP = std::make_unique<proton::Proton>(params.identity, _argc > 0 ? _argv[0] : "proton", std::chrono::milliseconds(params.subscribeTimeout)); + std::chrono::milliseconds subscribeTimeout(params.subscribeTimeout); + config::ConfigUri identityUri(params.identity); + protonUP = std::make_unique<proton::Proton>(identityUri, _argc > 0 ? _argv[0] : "proton", subscribeTimeout); proton::Proton & proton = *protonUP; proton::BootstrapConfig::SP configSnapshot = proton.init(); if (proton.hasAbortedInit()) { @@ -200,13 +202,14 @@ App::Main() } configSnapshot.reset(); std::unique_ptr<ProtonServiceLayerProcess> spiProton; + if ( ! params.serviceidentity.empty()) { - spiProton = std::make_unique<ProtonServiceLayerProcess>(params.serviceidentity, proton); - spiProton->setupConfig(std::chrono::milliseconds(params.subscribeTimeout)); + spiProton = std::make_unique<ProtonServiceLayerProcess>(identityUri.createWithNewId(params.serviceidentity), proton); + spiProton->setupConfig(subscribeTimeout); spiProton->createNode(); EV_STARTED("servicelayer"); } else { - proton.getMetricManager().init(params.identity, proton.getThreadPool()); + proton.getMetricManager().init(identityUri, proton.getThreadPool()); } EV_STARTED("proton"); while (!(SIG::INT.check() || SIG::TERM.check() || (spiProton && spiProton->getNode().attemptedStopped()))) { diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index 5c22c0b4196..827b9a04e36 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -118,7 +118,7 @@ public: std::string rtcPattern3 = "*/search/*/realtimecontroller"; try { - slobrok::ConfiguratorFactory sbcfg("client"); + slobrok::ConfiguratorFactory sbcfg(config::ConfigUri("client")); slobrok::api::MirrorAPI sbmirror(_frt->supervisor(), sbcfg); for (int timeout = 1; timeout < 20; timeout++) { if (!sbmirror.ready()) { @@ -170,7 +170,7 @@ public: std::string rtcPattern = "search/cluster.*/c*/r*/realtimecontroller"; try { - slobrok::ConfiguratorFactory sbcfg("client"); + slobrok::ConfiguratorFactory sbcfg(config::ConfigUri("client")); slobrok::api::MirrorAPI sbmirror(_frt->supervisor(), sbcfg); for (int timeout = 1; timeout < 20; timeout++) { if (!sbmirror.ready()) { diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 0aa0e1fb2ba..642f8746587 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -340,9 +340,8 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) initializeThreads.reset(); _prepareRestartHandler = std::make_unique<PrepareRestartHandler>(*_flushEngine); - RPCHooks::Params rpcParams(*this, protonConfig.rpcport, _configUri.getConfigId(), + RPCHooks::Params rpcParams(*this, protonConfig.rpcport, _configUri, protonConfig.slobrokconfigid, std::max(2u, computeRpcTransportThreads(protonConfig, hwInfo.cpu()))); - rpcParams.slobrok_config = _configUri.createWithNewId(protonConfig.slobrokconfigid); _rpcHooks = std::make_unique<RPCHooks>(rpcParams); _metricsEngine->addExternalMetrics(_rpcHooks->proto_rpc_adapter_metrics()); diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index b7fb4ecdd92..441829d0d4c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -166,11 +166,11 @@ RPCHooksBase::initRPC() rb.ReturnDesc("success", "Whether or not prepare for restart was triggered."); } -RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const vespalib::string &ident, - uint32_t transportThreads) +RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const config::ConfigUri & configUri, + vespalib::stringref slobrokId, uint32_t transportThreads) : proton(parent), - slobrok_config(config::ConfigUri("client")), - identity(ident), + slobrok_config(configUri.createWithNewId(slobrokId)), + identity(configUri.getConfigId()), rtcPort(port), numTranportThreads(transportThreads) { } diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index 19805da6610..4faa2c55b79 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -85,8 +85,8 @@ public: uint32_t rtcPort; uint32_t numTranportThreads; - Params(Proton &parent, uint32_t port, const vespalib::string &ident, - uint32_t numTransportThreads); + Params(Proton &parent, uint32_t port, const config::ConfigUri & configUri, + vespalib::stringref slobrokId, uint32_t numTransportThreads); ~Params(); }; RPCHooksBase(const RPCHooksBase &) = delete; diff --git a/slobrok/src/vespa/slobrok/server/sbenv.cpp b/slobrok/src/vespa/slobrok/server/sbenv.cpp index 2786bb9eb05..84bf212abb3 100644 --- a/slobrok/src/vespa/slobrok/server/sbenv.cpp +++ b/slobrok/src/vespa/slobrok/server/sbenv.cpp @@ -173,7 +173,7 @@ SBEnv::MainLoop() std::unique_ptr<ReconfigurableStateServer> stateServer; if (_configShim.enableStateServer()) { - stateServer = std::make_unique<ReconfigurableStateServer>(_configShim.configId(), _health, _metrics, _components); + stateServer = std::make_unique<ReconfigurableStateServer>(config::ConfigUri(_configShim.configId()), _health, _metrics, _components); } try { diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp index bb72887f69b..7491a3aae1d 100644 --- a/storage/src/tests/bucketdb/bucketmanagertest.cpp +++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp @@ -156,7 +156,7 @@ void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, _node->setTypeRepo(repo); _node->setupDummyPersistence(); // Set up the 3 links - auto manager = std::make_unique<BucketManager>(config.getConfigId(), _node->getComponentRegister()); + auto manager = std::make_unique<BucketManager>(config::ConfigUri(config.getConfigId()), _node->getComponentRegister()); _manager = manager.get(); _top->push_back(std::move(manager)); if (fakePersistenceLayer) { @@ -165,8 +165,8 @@ void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, _top->push_back(std::move(bottom)); } else { auto bottom = std::make_unique<FileStorManager>( - config.getConfigId(), - _node->getPersistenceProvider(), _node->getComponentRegister(), *_node, _node->get_host_info()); + config::ConfigUri(config.getConfigId()), + _node->getPersistenceProvider(), _node->getComponentRegister(), *_node, _node->get_host_info()); _top->push_back(std::move(bottom)); } // Generate a doc to use for testing.. diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index 9c63f05b453..d2a4f994bda 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -103,7 +103,7 @@ void MetricsTest::SetUp() { _visitorMetrics = std::make_shared<VisitorMetrics>(); _visitorMetrics->initThreads(4); _topSet->registerMetric(*_visitorMetrics); - _metricManager->init(_config->getConfigId(), _node->getThreadPool()); + _metricManager->init(config::ConfigUri(_config->getConfigId()), _node->getThreadPool()); } void MetricsTest::TearDown() { diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index 97bfa41aece..77d23314221 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.cpp @@ -108,7 +108,7 @@ TEST_F(StatusTest, index_status_page) { "barid", "Bar impl", "<p>info</p>")); StatusWebServer webServer(_node->getComponentRegister(), _node->getComponentRegister(), - "raw:httpport 0"); + config::ConfigUri("raw:httpport 0")); auto actual = fetch(webServer.getListenPort(), "/"); std::string expected( "HTTP\\/1.1 200 OK\r\n" @@ -143,7 +143,7 @@ TEST_F(StatusTest, html_status) { "fooid", "Foo impl", "<p>info</p>", "<!-- script -->")); StatusWebServer webServer(_node->getComponentRegister(), _node->getComponentRegister(), - "raw:httpport 0"); + config::ConfigUri("raw:httpport 0")); auto actual = fetch(webServer.getListenPort(), "/fooid?unusedParam"); std::string expected( "HTTP/1.1 200 OK\r\n" @@ -175,7 +175,7 @@ TEST_F(StatusTest, xml_sStatus) { "fooid", "Foo impl")); StatusWebServer webServer(_node->getComponentRegister(), _node->getComponentRegister(), - "raw:httpport 0"); + config::ConfigUri("raw:httpport 0")); auto actual = fetch(webServer.getListenPort(), "/fooid?unusedParam"); std::string expected( "HTTP/1.1 200 OK\r\n" @@ -200,7 +200,7 @@ TEST_F(StatusTest, xml_sStatus) { TEST_F(StatusTest, test404) { StatusWebServer webServer(_node->getComponentRegister(), _node->getComponentRegister(), - "raw:httpport 0"); + config::ConfigUri("raw:httpport 0")); auto actual = fetch(webServer.getListenPort(), "/fooid?unusedParam"); std::string expected( "HTTP/1.1 404 Not Found\r\n" diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp index 8ab1790d9bc..24504a2006b 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.cpp +++ b/storage/src/tests/persistence/common/filestortestfixture.cpp @@ -76,7 +76,7 @@ FileStorTestFixture::TestFileStorComponents::TestFileStorComponents( manager(nullptr) { injector.inject(top); - auto fsm = std::make_unique<FileStorManager>(fixture._config->getConfigId(), fixture._node->getPersistenceProvider(), + auto fsm = std::make_unique<FileStorManager>(config::ConfigUri(fixture._config->getConfigId()), fixture._node->getPersistenceProvider(), fixture._node->getComponentRegister(), *fixture._node, fixture._node->get_host_info()); manager = fsm.get(); top.push_back(std::move(fsm)); diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 939e7ae7b6a..baed51663f8 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -247,7 +247,7 @@ struct TestFileStorComponents { explicit TestFileStorComponents(FileStorTestBase& test, bool use_small_config = false) : manager(nullptr) { - auto fsm = std::make_unique<FileStorManager>((use_small_config ? test.smallConfig : test.config)->getConfigId(), + auto fsm = std::make_unique<FileStorManager>(config::ConfigUri((use_small_config ? test.smallConfig : test.config)->getConfigId()), test._node->getPersistenceProvider(), test._node->getComponentRegister(), *test._node, test._node->get_host_info()); manager = fsm.get(); diff --git a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp index c6ee69f2bf2..3a1f41cb82c 100644 --- a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp @@ -39,7 +39,7 @@ struct BucketCheckerInjector : FileStorTestFixture::StorageLinkInjector link.push_back(std::make_unique<ModifiedBucketChecker>( _node.getComponentRegister(), _node.getPersistenceProvider(), - _fixture._config->getConfigId())); + config::ConfigUri(_fixture._config->getConfigId()))); } }; diff --git a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp index 9130b469794..55fd2680832 100644 --- a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp +++ b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp @@ -47,7 +47,7 @@ ModifiedBucketCheckerTest::SetUp() _top.reset(new DummyStorageLink); _handler = new ModifiedBucketChecker(_node->getComponentRegister(), _node->getPersistenceProvider(), - _config->getConfigId()); + config::ConfigUri(_config->getConfigId())); _top->push_back(std::unique_ptr<StorageLink>(_handler)); _bottom = new DummyStorageLink; _handler->push_back(std::unique_ptr<StorageLink>(_bottom)); diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index 2b87fd3cabf..acd2d978f9e 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -72,7 +72,7 @@ void BouncerTest::setUpAsNode(const lib::NodeType& type) { _node.reset(new TestDistributorApp(NodeIndex(2), config.getConfigId())); } _upper.reset(new DummyStorageLink()); - _manager = new Bouncer(_node->getComponentRegister(), config.getConfigId()); + _manager = new Bouncer(_node->getComponentRegister(), config::ConfigUri(config.getConfigId())); _lower = new DummyStorageLink(); _upper->push_back(std::unique_ptr<StorageLink>(_manager)); _upper->push_back(std::unique_ptr<StorageLink>(_lower)); diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp index c96deaff321..1aaca53d15a 100644 --- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp +++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp @@ -125,7 +125,7 @@ ChangedBucketOwnershipHandlerTest::SetUp() _app.reset(new TestServiceLayerApp); _top.reset(new DummyStorageLink); - _handler = new ChangedBucketOwnershipHandler(config.getConfigId(), + _handler = new ChangedBucketOwnershipHandler(config::ConfigUri(config.getConfigId()), _app->getComponentRegister()); _top->push_back(std::unique_ptr<StorageLink>(_handler)); _bottom = new DummyStorageLink; diff --git a/storage/src/tests/storageserver/communicationmanagertest.cpp b/storage/src/tests/storageserver/communicationmanagertest.cpp index ba5e0c3c116..f8462d528c7 100644 --- a/storage/src/tests/storageserver/communicationmanagertest.cpp +++ b/storage/src/tests/storageserver/communicationmanagertest.cpp @@ -60,9 +60,9 @@ TEST_F(CommunicationManagerTest, simple) { TestDistributorApp distNode(distConfig.getConfigId()); CommunicationManager distributor(distNode.getComponentRegister(), - distConfig.getConfigId()); + config::ConfigUri(distConfig.getConfigId())); CommunicationManager storage(storNode.getComponentRegister(), - storConfig.getConfigId()); + config::ConfigUri(storConfig.getConfigId())); DummyStorageLink *distributorLink = new DummyStorageLink(); DummyStorageLink *storageLink = new DummyStorageLink(); distributor.push_back(std::unique_ptr<StorageLink>(distributorLink)); @@ -112,7 +112,7 @@ CommunicationManagerTest::doTestConfigPropagation(bool isContentNode) } CommunicationManager commMgr(node->getComponentRegister(), - config.getConfigId()); + config::ConfigUri(config.getConfigId())); DummyStorageLink *storageLink = new DummyStorageLink(); commMgr.push_back(std::unique_ptr<StorageLink>(storageLink)); commMgr.open(); @@ -158,7 +158,7 @@ TEST_F(CommunicationManagerTest, commands_are_dequeued_in_fifo_order) { TestServiceLayerApp storNode(storConfig.getConfigId()); CommunicationManager storage(storNode.getComponentRegister(), - storConfig.getConfigId()); + config::ConfigUri(storConfig.getConfigId())); DummyStorageLink *storageLink = new DummyStorageLink(); storage.push_back(std::unique_ptr<StorageLink>(storageLink)); storage.open(); @@ -191,7 +191,7 @@ TEST_F(CommunicationManagerTest, replies_are_dequeued_in_fifo_order) { TestServiceLayerApp storNode(storConfig.getConfigId()); CommunicationManager storage(storNode.getComponentRegister(), - storConfig.getConfigId()); + config::ConfigUri(storConfig.getConfigId())); DummyStorageLink *storageLink = new DummyStorageLink(); storage.push_back(std::unique_ptr<StorageLink>(storageLink)); storage.open(); @@ -232,7 +232,7 @@ struct CommunicationManagerFixture { node = std::make_unique<TestServiceLayerApp>(stor_config.getConfigId()); comm_mgr = std::make_unique<CommunicationManager>(node->getComponentRegister(), - stor_config.getConfigId()); + config::ConfigUri(stor_config.getConfigId())); bottom_link = new DummyStorageLink(); comm_mgr->push_back(std::unique_ptr<StorageLink>(bottom_link)); comm_mgr->open(); diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp index d4d9d54557d..4b3cd3dfe17 100644 --- a/storage/src/tests/storageserver/documentapiconvertertest.cpp +++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp @@ -3,7 +3,6 @@ #include <vespa/config/subscription/configuri.h> #include <vespa/document/base/testdocrepo.h> #include <vespa/document/bucket/bucketidfactory.h> -#include <vespa/document/config/documenttypes_config_fwd.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/select/parser.h> @@ -74,7 +73,7 @@ struct DocumentApiConverterTest : Test { } void SetUp() override { - _converter = std::make_unique<DocumentApiConverter>("raw:", _bucketResolver); + _converter = std::make_unique<DocumentApiConverter>(config::ConfigUri("raw:"), _bucketResolver); }; template <typename DerivedT, typename BaseT> diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp index 89b769078cc..77c674ff1e6 100644 --- a/storage/src/tests/storageserver/mergethrottlertest.cpp +++ b/storage/src/tests/storageserver/mergethrottlertest.cpp @@ -2,23 +2,19 @@ #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <tests/common/teststorageapp.h> -#include <tests/common/dummystoragelink.h> #include <vespa/document/test/make_document_bucket.h> #include <vespa/messagebus/dynamicthrottlepolicy.h> -#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/storageserver/mergethrottler.h> #include <vespa/storage/persistence/messages.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> -#include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/exceptions.h> #include <unordered_set> #include <memory> #include <iterator> #include <vector> -#include <algorithm> #include <chrono> #include <thread> @@ -178,7 +174,7 @@ MergeThrottlerTest::SetUp() std::unique_ptr<DummyStorageLink> top; top = std::make_unique<DummyStorageLink>(); - MergeThrottler* throttler = new MergeThrottler(config.getConfigId(), server->getComponentRegister()); + MergeThrottler* throttler = new MergeThrottler(::config::ConfigUri(config.getConfigId()), server->getComponentRegister()); // MergeThrottler will be sandwiched in between two dummy links top->push_back(std::unique_ptr<StorageLink>(throttler)); DummyStorageLink* bottom = new DummyStorageLink; diff --git a/storage/src/tests/storageserver/priorityconvertertest.cpp b/storage/src/tests/storageserver/priorityconvertertest.cpp index 2f79a14af58..c18f36f9b6c 100644 --- a/storage/src/tests/storageserver/priorityconvertertest.cpp +++ b/storage/src/tests/storageserver/priorityconvertertest.cpp @@ -1,6 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/documentapi/documentapi.h> #include <vespa/storage/storageserver/priorityconverter.h> #include <tests/common/testhelper.h> #include <vespa/vespalib/gtest/gtest.h> @@ -14,16 +13,14 @@ struct PriorityConverterTest : Test { void SetUp() override { vdstestlib::DirConfig config(getStandardConfig(true)); - _converter = std::make_unique<PriorityConverter>(config.getConfigId()); + _converter = std::make_unique<PriorityConverter>(config::ConfigUri(config.getConfigId())); }; }; TEST_F(PriorityConverterTest, normal_usage) { for (int p = 0; p < 16; ++p) { - EXPECT_EQ( - (50 + p * 10), - _converter->toStoragePriority( - static_cast<documentapi::Priority::Value>(p))); + EXPECT_EQ((50 + p * 10), + _converter->toStoragePriority(static_cast<documentapi::Priority::Value>(p))); } for (int i = 0; i < 256; ++i) { uint8_t p = i; diff --git a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp index 8bfe9c1e692..bac1ab34574 100644 --- a/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp +++ b/storage/src/tests/storageserver/rpc/cluster_controller_rpc_api_service_test.cpp @@ -57,7 +57,7 @@ struct FixtureBase { config.getConfig("stor-server").set("node_index", "1"); addSlobrokConfig(config, slobrok); - shared_rpc_resources = std::make_unique<SharedRpcResources>(config.getConfigId(), 0, 1, 1); + shared_rpc_resources = std::make_unique<SharedRpcResources>(config::ConfigUri(config.getConfigId()), 0, 1, 1); cc_service = std::make_unique<ClusterControllerApiRpcService>(dispatcher, *shared_rpc_resources); shared_rpc_resources->start_server_and_register_slobrok("my_cool_rpc_test"); } diff --git a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp index 47d7d9fbdeb..07b009bf981 100644 --- a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp +++ b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp @@ -119,7 +119,7 @@ public: cfg.set("is_distributor", is_distributor ? "true" : "false"); addSlobrokConfig(_config, slobrok); - _shared_rpc_resources = std::make_unique<SharedRpcResources>(_config.getConfigId(), 0, 1, 1); + _shared_rpc_resources = std::make_unique<SharedRpcResources>(config::ConfigUri(_config.getConfigId()), 0, 1, 1); // TODO make codec provider into interface so we can test decode-failures more easily? _codec_provider = std::make_unique<MessageCodecProvider>(_doc_type_repo); } diff --git a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp index acc3e49e345..571bebd9c86 100644 --- a/storage/src/tests/storageserver/service_layer_error_listener_test.cpp +++ b/storage/src/tests/storageserver/service_layer_error_listener_test.cpp @@ -37,7 +37,7 @@ struct Fixture { vdstestlib::DirConfig config{getStandardConfig(true)}; TestServiceLayerApp app; ServiceLayerComponent component{app.getComponentRegister(), "dummy"}; - MergeThrottler merge_throttler{config.getConfigId(), app.getComponentRegister()}; + MergeThrottler merge_throttler{config::ConfigUri(config.getConfigId()), app.getComponentRegister()}; TestShutdownListener shutdown_listener; ServiceLayerErrorListener error_listener{component, merge_throttler}; diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index 16d313ce5d1..77192d24786 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -95,7 +95,7 @@ void StateReporterTest::SetUp() { _filestorMetrics->initDiskMetrics(1, 1); _topSet->registerMetric(*_filestorMetrics); - _metricManager->init(_config->getConfigId(), _node->getThreadPool()); + _metricManager->init(config::ConfigUri(_config->getConfigId()), _node->getThreadPool()); } void StateReporterTest::TearDown() { diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h index 548d4c0b69a..d10e8f0c285 100644 --- a/storage/src/tests/storageserver/testvisitormessagesession.h +++ b/storage/src/tests/storageserver/testvisitormessagesession.h @@ -54,7 +54,7 @@ struct TestVisitorMessageSessionFactory : public VisitorMessageSessionFactory TestVisitorMessageSessionFactory(vespalib::stringref configId = "") : _createAutoReplyVisitorSessions(false), - _priConverter(configId) {} + _priConverter(config::ConfigUri(configId)) {} VisitorMessageSession::UP createSession(Visitor& v, VisitorThread& vt) override { std::lock_guard lock(_accessLock); diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index abd871dad23..99172264d47 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -1,6 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/datatype/datatype.h> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/storageapi/message/datagram.h> @@ -89,10 +88,10 @@ VisitorManagerTest::initializeTest() _node->setupDummyPersistence(); _node->getStateUpdater().setClusterState(std::make_shared<lib::ClusterState>("storage:1 distributor:1")); _top = std::make_unique<DummyStorageLink>(); - auto vm = std::make_unique<VisitorManager>(config.getConfigId(), _node->getComponentRegister(), *_messageSessionFactory); + auto vm = std::make_unique<VisitorManager>(config::ConfigUri(config.getConfigId()), _node->getComponentRegister(), *_messageSessionFactory); _manager = vm.get(); _top->push_back(std::move(vm)); - _top->push_back(std::make_unique<FileStorManager>(config.getConfigId(), _node->getPersistenceProvider(), + _top->push_back(std::make_unique<FileStorManager>(config::ConfigUri(config.getConfigId()), _node->getPersistenceProvider(), _node->getComponentRegister(), *_node, _node->get_host_info())); _manager->setTimeBetweenTicks(10); _top->open(); diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 945a08d910e..f159bf85d22 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -166,7 +166,7 @@ VisitorTest::initializeTest(const TestParams& params) _top.reset(new DummyStorageLink()); _top->push_back(std::unique_ptr<StorageLink>(_manager = new VisitorManager( - config.getConfigId(), + config::ConfigUri(config.getConfigId()), _node->getComponentRegister(), *_messageSessionFactory))); _bottom = new DummyStorageLink(); _top->push_back(std::unique_ptr<StorageLink>(_bottom)); diff --git a/storage/src/vespa/storage/tools/storage-cmd.cpp b/storage/src/vespa/storage/tools/storage-cmd.cpp index 0f3cde759c5..8c2a1f40529 100644 --- a/storage/src/vespa/storage/tools/storage-cmd.cpp +++ b/storage/src/vespa/storage/tools/storage-cmd.cpp @@ -61,7 +61,7 @@ public: int retCode = 0; fnet::frt::StandaloneFRT supervisor; - slobrok::ConfiguratorFactory sbcfg("client"); + slobrok::ConfiguratorFactory sbcfg(config::ConfigUri("client")); slobrok::api::MirrorAPI mirror(supervisor.supervisor(), sbcfg); while (!mirror.ready()) { diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index 2c79ebf700b..aaa85f7f476 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -37,11 +37,11 @@ Process::UP createProcess(vespalib::stringref configId) { config::ConfigUri uri(configId); std::unique_ptr<vespa::config::content::core::StorServerConfig> serverConfig = config::ConfigGetter<vespa::config::content::core::StorServerConfig>::getConfig(uri.getConfigId(), uri.getContext()); if (serverConfig->isDistributor) { - return std::make_unique<DistributorProcess>(configId); + return std::make_unique<DistributorProcess>(uri); } else switch (serverConfig->persistenceProvider.type) { case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::STORAGE: case vespa::config::content::core::StorServerConfig::PersistenceProvider::Type::DUMMY: - return std::make_unique<DummyServiceLayerProcess>(configId); + return std::make_unique<DummyServiceLayerProcess>(uri); default: throw vespalib::IllegalStateException("Unknown persistence provider.", VESPA_STRLOC); } diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp index a7fa0b03799..d2cfaac03c2 100644 --- a/storageserver/src/tests/storageservertest.cpp +++ b/storageserver/src/tests/storageservertest.cpp @@ -62,7 +62,7 @@ struct Storage : public Node { }; Distributor::Distributor(vdstestlib::DirConfig& config) - : _process(config.getConfigId()) + : _process(config::ConfigUri(config.getConfigId())) { _process.setupConfig(60000ms); _process.createNode(); @@ -71,7 +71,7 @@ Distributor::Distributor(vdstestlib::DirConfig& config) Distributor::~Distributor() = default; Storage::Storage(vdstestlib::DirConfig& config) - : _process(config.getConfigId()) + : _process(config::ConfigUri(config.getConfigId())) { _process.setupConfig(60000ms); _process.createNode(); diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp index ba13f2aeb91..7e65ff68601 100644 --- a/storageserver/src/vespa/storageserver/app/distributorprocess.cpp +++ b/storageserver/src/vespa/storageserver/app/distributorprocess.cpp @@ -55,7 +55,7 @@ adjusted_num_distributor_stripes(int32_t cfg_n_stripes) } void -DistributorProcess::setupConfig(milliseconds subscribeTimeout) +DistributorProcess::setupConfig(vespalib::duration subscribeTimeout) { using vespa::config::content::core::StorDistributormanagerConfig; using vespa::config::content::core::StorVisitordispatcherConfig; diff --git a/storageserver/src/vespa/storageserver/app/distributorprocess.h b/storageserver/src/vespa/storageserver/app/distributorprocess.h index 678f131d275..f9d6cc41f4d 100644 --- a/storageserver/src/vespa/storageserver/app/distributorprocess.h +++ b/storageserver/src/vespa/storageserver/app/distributorprocess.h @@ -29,7 +29,7 @@ public: ~DistributorProcess() override; void shutdown() override; - void setupConfig(milliseconds subscribeTimeout) override; + void setupConfig(vespalib::duration subscribeTimeout) override; void createNode() override; bool configUpdated() override; void updateConfig() override; diff --git a/storageserver/src/vespa/storageserver/app/process.cpp b/storageserver/src/vespa/storageserver/app/process.cpp index 93d19c8e6fc..ad4d9ffa7f6 100644 --- a/storageserver/src/vespa/storageserver/app/process.cpp +++ b/storageserver/src/vespa/storageserver/app/process.cpp @@ -22,7 +22,7 @@ Process::Process(const config::ConfigUri & configUri) Process::~Process() = default; void -Process::setupConfig(milliseconds subscribeTimeout) +Process::setupConfig(vespalib::duration subscribeTimeout) { _documentHandler = _configSubscriber.subscribe<document::config::DocumenttypesConfig>(_configUri.getConfigId(), subscribeTimeout); if (!_configSubscriber.nextConfig()) { diff --git a/storageserver/src/vespa/storageserver/app/process.h b/storageserver/src/vespa/storageserver/app/process.h index fcda67fb201..7050dca6b92 100644 --- a/storageserver/src/vespa/storageserver/app/process.h +++ b/storageserver/src/vespa/storageserver/app/process.h @@ -39,12 +39,11 @@ private: public: using UP = std::unique_ptr<Process>; - using milliseconds = std::chrono::milliseconds; Process(const config::ConfigUri & configUri); ~Process() override; - virtual void setupConfig(milliseconds subscribeTimeout); + virtual void setupConfig(vespalib::duration subscribeTimeout); virtual void createNode() = 0; virtual bool configUpdated(); virtual void updateConfig(); diff --git a/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp b/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp index a936146fd26..249a6f056f0 100644 --- a/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp +++ b/streamingvisitors/src/tests/searchvisitor/searchvisitor_test.cpp @@ -44,7 +44,7 @@ public: SearchVisitorTest::SearchVisitorTest() : vespalib::TestApp(), _componentRegister(), - _env("dir:" + TEST_PATH("cfg")) + _env(::config::ConfigUri("dir:" + TEST_PATH("cfg"))) { _componentRegister.setNodeInfo("mycluster", lib::NodeType::STORAGE, 1); _componentRegister.setClock(_clock); @@ -69,7 +69,8 @@ createDocuments(const vespalib::string & dir) void SearchVisitorTest::testCreateSearchVisitor(const vespalib::string & dir, const vdslib::Parameters & params) { - SearchVisitorFactory sFactory(dir); + ::config::ConfigUri uri(dir); + SearchVisitorFactory sFactory(uri); VisitorFactory & factory(sFactory); std::unique_ptr<Visitor> sv(static_cast<SearchVisitor *>(factory.makeVisitor(*_component, _env, params))); document::BucketId bucketId; @@ -107,7 +108,7 @@ SearchVisitorTest::testSearchVisitor() void SearchVisitorTest::testOnlyRequireWeakReadConsistency() { - SearchVisitorFactory factory("dir:" + TEST_PATH("cfg")); + SearchVisitorFactory factory(::config::ConfigUri("dir:" + TEST_PATH("cfg"))); VisitorFactory& factoryBase(factory); vdslib::Parameters params; std::unique_ptr<Visitor> sv(factoryBase.makeVisitor(*_component, _env, params)); diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index 6b77f47b4cd..4e050affec6 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/config-stor-distribution.h> -#include <vespa/config/helper/configfetcher.h> #include <vespa/config/helper/configgetter.hpp> #include <vespa/config/subscription/configuri.h> #include <vespa/fastos/file.h> @@ -48,7 +47,7 @@ TEST(DistributionTest, test_verify_java_distributions) } ClusterState state(mystate); Distribution distr(readConfig<vespa::config::content::StorDistributionConfig>( - "file:distribution/testdata/java_" + test + ".cfg")); + config::ConfigUri("file:distribution/testdata/java_" + test + ".cfg"))); std::ofstream of("distribution/testdata/cpp_" + test + ".distribution"); long maxBucket = 1; diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp index 7a697941d88..75d8f770c1a 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp +++ b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp @@ -30,7 +30,7 @@ Application::Application() : _params() { } -Application::~Application() {} +Application::~Application() = default; int @@ -46,7 +46,7 @@ Application::Main() auto repo = std::make_shared<DocumentTypeRepo>( *ConfigGetter<DocumenttypesConfig>::getConfig(_params.getDocumentTypesConfigId())); - _net = std::make_unique<MyNetwork>(mbus::RPCNetworkParams(_params.getSlobrokConfigId()) + _net = std::make_unique<MyNetwork>(mbus::RPCNetworkParams(config::ConfigUri(_params.getSlobrokConfigId())) .setIdentity(_params.getRPCNetworkParams().getIdentity()) .setListenPort(_params.getRPCNetworkParams().getListenPort())); _mbus = std::make_unique<mbus::MessageBus>( |