diff options
44 files changed, 213 insertions, 174 deletions
diff --git a/config/src/vespa/config/common/configcontext.h b/config/src/vespa/config/common/configcontext.h index 6ada928fd5f..20cfbe8711e 100644 --- a/config/src/vespa/config/common/configcontext.h +++ b/config/src/vespa/config/common/configcontext.h @@ -1,39 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/util/sync.h> -#include <vespa/vespalib/stllike/hash_map.h> +#include "iconfigcontext.h" #include "timingvalues.h" #include "configmanager.h" #include <vespa/config/subscription/sourcespec.h> +#include <vespa/vespalib/util/sync.h> +#include <vespa/vespalib/stllike/hash_map.h> namespace config { -/** - * A ConfigContext is a context object that can be used to consolidate - * multiple ConfigSubscribers to use the same resources. It also gives the - * ability to reload config for unit testing or if using file configs. - */ -class IConfigContext -{ -public: - typedef std::shared_ptr<IConfigContext> SP; - - /** - * Get an instance of the config manager. - * - * @return reference to a manager instance. - */ - virtual IConfigManager & getManagerInstance() = 0; - - /** - * Reload config for source provided by this context. - */ - virtual void reload() = 0; - - virtual ~IConfigContext() { } -}; - class ConfigContext : public IConfigContext { public: @@ -43,8 +19,8 @@ public: void reload(); private: - TimingValues _timingValues; - int64_t _generation; + TimingValues _timingValues; + int64_t _generation; ConfigManager _manager; }; diff --git a/config/src/vespa/config/common/iconfigcontext.h b/config/src/vespa/config/common/iconfigcontext.h new file mode 100644 index 00000000000..576dbc3c548 --- /dev/null +++ b/config/src/vespa/config/common/iconfigcontext.h @@ -0,0 +1,36 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include <memory> + +namespace config { + +class IConfigManager; + +/** + * A ConfigContext is a context object that can be used to consolidate + * multiple ConfigSubscribers to use the same resources. It also gives the + * ability to reload config for unit testing or if using file configs. + */ +class IConfigContext +{ +public: + typedef std::shared_ptr<IConfigContext> SP; + + /** + * Get an instance of the config manager. + * + * @return reference to a manager instance. + */ + virtual IConfigManager & getManagerInstance() = 0; + + /** + * Reload config for source provided by this context. + */ + virtual void reload() = 0; + + virtual ~IConfigContext() { } +}; + +} // namespace + diff --git a/config/src/vespa/config/subscription/configuri.cpp b/config/src/vespa/config/subscription/configuri.cpp index 0e63920bd63..f458408d851 100644 --- a/config/src/vespa/config/subscription/configuri.cpp +++ b/config/src/vespa/config/subscription/configuri.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "configuri.h" #include "configinstancespec.h" +#include <vespa/config/common/configcontext.h> #include <vespa/config/helper/legacy.h> namespace { diff --git a/config/src/vespa/config/subscription/configuri.h b/config/src/vespa/config/subscription/configuri.h index 4e327a7db94..ade6b3881b3 100644 --- a/config/src/vespa/config/subscription/configuri.h +++ b/config/src/vespa/config/subscription/configuri.h @@ -1,11 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <string> -#include <vespa/config/common/configcontext.h> +#include <vespa/config/common/iconfigcontext.h> +#include <vespa/config/configgen/configinstance.h> namespace config { +class SourceSpec; + /** * A ConfigUri is a single representation of a configId and its source. The * purpose of this class is to make it more convenient to deal with config @@ -97,9 +99,9 @@ public: bool empty() const { return _empty; } private: - vespalib::string _configId; + vespalib::string _configId; IConfigContext::SP _context; - bool _empty; + bool _empty; }; } // namespace config diff --git a/documentapi/src/tests/messages/testbase.cpp b/documentapi/src/tests/messages/testbase.cpp index 75f569b306f..54d7a47e4b8 100644 --- a/documentapi/src/tests/messages/testbase.cpp +++ b/documentapi/src/tests/messages/testbase.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".testbase"); #include "testbase.h" #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> +#include <vespa/vespalib/util/exception.h> +#include <vespa/log/log.h> +LOG_SETUP(".testbase"); using document::DocumentTypeRepo; using document::readDocumenttypesConfig; diff --git a/documentapi/src/tests/policies/testframe.cpp b/documentapi/src/tests/policies/testframe.cpp index cb30e5377aa..0c4fd90a5c4 100644 --- a/documentapi/src/tests/policies/testframe.cpp +++ b/documentapi/src/tests/policies/testframe.cpp @@ -311,7 +311,7 @@ bool TestFrame::waitSlobrok(const string &pattern, uint32_t cnt) { for (uint32_t i = 0; i < 1000; ++i) { - slobrok::api::MirrorAPI::SpecList res = _net->getMirror().lookup(pattern); + slobrok::api::IMirrorAPI::SpecList res = _net->getMirror().lookup(pattern); if (res.size() == cnt) { return true; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp index 01eaa8b5523..4ac6a91fd47 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.cpp @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + +#include "getbucketlistreply.h" #include <vespa/documentapi/messagebus/documentprotocol.h> -#include <vespa/documentapi/messagebus/messages/getbucketlistreply.h> +#include <ostream> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h index ade2c78024a..536be0044fe 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h @@ -7,6 +7,7 @@ #include <vespa/messagebus/routing/route.h> #include <vespa/messagebus/routing/routingcontext.h> #include <vespa/vespalib/util/sync.h> +#include <vespa/vespalib/util/ptrholder.h> #include <vespa/config-messagetyperouteselectorpolicy.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp index 36d7776f732..e8fb670dd9b 100644 --- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp +++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp @@ -97,7 +97,7 @@ bool Test::waitSlobrok(RPCNetwork &network, const string &pattern, size_t num) { for (int i = 0; i < 1000; i++) { - slobrok::api::MirrorAPI::SpecList res = network.getMirror().lookup(pattern); + slobrok::api::IMirrorAPI::SpecList res = network.getMirror().lookup(pattern); if (res.size() == num) { return true; } diff --git a/messagebus/src/vespa/messagebus/network/inetwork.h b/messagebus/src/vespa/messagebus/network/inetwork.h index 9ca024d77a0..b218a0689a2 100644 --- a/messagebus/src/vespa/messagebus/network/inetwork.h +++ b/messagebus/src/vespa/messagebus/network/inetwork.h @@ -3,7 +3,7 @@ #include <memory> #include <vespa/messagebus/routing/routingnode.h> -#include <vespa/slobrok/sbmirror.h> +#include <vespa/slobrok/imirrorapi.h> #include "inetworkowner.h" namespace mbus { diff --git a/messagebus/src/vespa/messagebus/network/oosmanager.cpp b/messagebus/src/vespa/messagebus/network/oosmanager.cpp index 97d2fc9e960..f48d457d401 100644 --- a/messagebus/src/vespa/messagebus/network/oosmanager.cpp +++ b/messagebus/src/vespa/messagebus/network/oosmanager.cpp @@ -60,7 +60,7 @@ OOSManager::PerformTask() } OOSManager::OOSManager(FRT_Supervisor &orb, - slobrok::api::MirrorAPI &mirror, + IMirrorAPI &mirror, const string &servicePattern) : FNET_Task(orb.GetScheduler()), _orb(orb), diff --git a/messagebus/src/vespa/messagebus/network/oosmanager.h b/messagebus/src/vespa/messagebus/network/oosmanager.h index 8ae28f30424..32941e5a98f 100644 --- a/messagebus/src/vespa/messagebus/network/oosmanager.h +++ b/messagebus/src/vespa/messagebus/network/oosmanager.h @@ -3,7 +3,7 @@ #include <vespa/fnet/fnet.h> #include <set> -#include <vespa/slobrok/sbmirror.h> +#include <vespa/slobrok/imirrorapi.h> #include <string> #include <vespa/vespalib/util/sync.h> #include "oosclient.h" @@ -22,15 +22,15 @@ public: /** * Convenience typedefs. */ - typedef slobrok::api::MirrorAPI MirrorAPI; - typedef MirrorAPI::SpecList SpecList; + typedef slobrok::api::IMirrorAPI IMirrorAPI; + typedef IMirrorAPI::SpecList SpecList; typedef std::vector<OOSClient::SP> ClientList; typedef std::set<string> StringSet; typedef std::shared_ptr<StringSet> OOSSet; private: - FRT_Supervisor &_orb; - MirrorAPI &_mirror; + FRT_Supervisor &_orb; + IMirrorAPI &_mirror; bool _disabled; bool _ready; vespalib::Lock _lock; @@ -64,7 +64,7 @@ public: * @param servicePattern The service pattern for oos servers. */ OOSManager(FRT_Supervisor &orb, - slobrok::api::MirrorAPI &mirror, + IMirrorAPI &mirror, const string &servicePattern); /** diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index 8ec6794919b..b0101753452 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -1,15 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/messagebus/emptyreply.h> -#include <vespa/messagebus/errorcode.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/tracelevel.h> -#include <vespa/vespalib/util/vstringfmt.h> -#include <vespa/vespalib/util/sync.h> #include "inetworkowner.h" #include "rpcnetwork.h" #include "rpcsendv1.h" #include "rpcservice.h" +#include <vespa/messagebus/emptyreply.h> +#include <vespa/messagebus/errorcode.h> +#include <vespa/messagebus/iprotocol.h> +#include <vespa/messagebus/tracelevel.h> +#include <vespa/slobrok/sbregister.h> +#include <vespa/slobrok/sbmirror.h> #include <vespa/log/log.h> LOG_SETUP(".rpcnetwork"); @@ -108,9 +107,9 @@ RPCNetwork::RPCNetwork(const RPCNetworkParams ¶ms) : _targetPool(params.getConnectionExpireSecs()), _targetPoolTask(_scheduler, _targetPool), _servicePool(*this, 4096), - _mirror(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig())), - _regAPI(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig())), - _oosManager(_orb, _mirror, params.getOOSServerPattern()), + _mirror(std::make_unique<slobrok::api::MirrorAPI>(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig()))), + _regAPI(std::make_unique<slobrok::api::RegisterAPI>(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig()))), + _oosManager(_orb, *_mirror, params.getOOSServerPattern()), _requestedPort(params.getListenPort()), _sendV1(), _sendAdapters() @@ -221,7 +220,7 @@ bool RPCNetwork::waitUntilReady(double seconds) const { for (uint32_t i = 0; i < seconds * 100; ++i) { - if (_mirror.ready() && _oosManager.isReady()) { + if (_mirror->ready() && _oosManager.isReady()) { return true; } FastOS_Thread::Sleep(10); @@ -241,7 +240,7 @@ RPCNetwork::registerSession(const string &session) string name = _ident.getServicePrefix(); name += "/"; name += session; - _regAPI.registerName(name); + _regAPI->registerName(name); } void @@ -253,7 +252,7 @@ RPCNetwork::unregisterSession(const string &session) string name = _ident.getServicePrefix(); name += "/"; name += session; - _regAPI.unregisterName(name); + _regAPI->unregisterName(name); } bool @@ -374,7 +373,7 @@ RPCNetwork::postShutdownHook() const slobrok::api::IMirrorAPI & RPCNetwork::getMirror() const { - return _mirror; + return *_mirror; } } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.h b/messagebus/src/vespa/messagebus/network/rpcnetwork.h index 4f96b426abb..4196a5c89a5 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.h +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.h @@ -5,8 +5,7 @@ #include <vespa/messagebus/blobref.h> #include <vespa/messagebus/message.h> #include <vespa/messagebus/reply.h> -#include <vespa/slobrok/sbmirror.h> -#include <vespa/slobrok/sbregister.h> +#include <vespa/slobrok/imirrorapi.h> #include <vespa/vespalib/component/versionspecification.h> #include "inetwork.h" #include "oosmanager.h" @@ -15,8 +14,13 @@ #include "rpcservicepool.h" #include "rpctargetpool.h" -namespace mbus { +namespace slobrok { + namespace api { + class RegisterAPI; + } +} +namespace mbus { /** * Network implementation based on RPC. This class is responsible for * keeping track of services and for sending messages to services. @@ -56,8 +60,8 @@ private: RPCTargetPool _targetPool; TargetPoolTask _targetPoolTask; RPCServicePool _servicePool; - slobrok::api::MirrorAPI _mirror; - slobrok::api::RegisterAPI _regAPI; + std::unique_ptr<slobrok::api::IMirrorAPI> _mirror; + std::unique_ptr<slobrok::api::RegisterAPI> _regAPI; OOSManager _oosManager; int _requestedPort; RPCSendV1 _sendV1; diff --git a/messagebus/src/vespa/messagebus/network/rpcservice.cpp b/messagebus/src/vespa/messagebus/network/rpcservice.cpp index 64c60d0e01f..60b23f523c7 100644 --- a/messagebus/src/vespa/messagebus/network/rpcservice.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcservice.cpp @@ -7,7 +7,7 @@ namespace mbus { -RPCService::RPCService(const slobrok::api::IMirrorAPI &mirror, +RPCService::RPCService(const Mirror &mirror, const string &pattern) : _mirror(mirror), _pattern(pattern), diff --git a/messagebus/src/vespa/messagebus/network/rpcservice.h b/messagebus/src/vespa/messagebus/network/rpcservice.h index f4f660e7e09..2566ad0f262 100644 --- a/messagebus/src/vespa/messagebus/network/rpcservice.h +++ b/messagebus/src/vespa/messagebus/network/rpcservice.h @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/slobrok/sbmirror.h> -#include <vespa/slobrok/sbregister.h> +#include <vespa/slobrok/imirrorapi.h> #include <vespa/vespalib/util/linkedptr.h> #include "rpcserviceaddress.h" @@ -17,8 +16,8 @@ class RPCNetwork; */ class RPCService { private: - typedef slobrok::api::IMirrorAPI Mirror; - typedef slobrok::api::MirrorAPI::SpecList AddressList; + typedef slobrok::api::IMirrorAPI Mirror; + typedef Mirror::SpecList AddressList; const Mirror &_mirror; string _pattern; @@ -37,7 +36,7 @@ public: * @param mirror The naming server to send queries to. * @param pattern The pattern to use when querying. */ - RPCService(const slobrok::api::IMirrorAPI &mirror, const string &pattern); + RPCService(const Mirror &mirror, const string &pattern); /** * Resolve a concrete address from this service. This service may represent diff --git a/messagebus/src/vespa/messagebus/routing/routingcontext.h b/messagebus/src/vespa/messagebus/routing/routingcontext.h index b9c26dc6224..9edcd5aa014 100644 --- a/messagebus/src/vespa/messagebus/routing/routingcontext.h +++ b/messagebus/src/vespa/messagebus/routing/routingcontext.h @@ -3,8 +3,7 @@ #include <vespa/messagebus/context.h> #include <vespa/messagebus/messagebus.h> -#include <vespa/slobrok/sbmirror.h> -#include <string> +#include <vespa/slobrok/imirrorapi.h> #include <set> #include "hop.h" #include "policydirective.h" diff --git a/messagebus/src/vespa/messagebus/testlib/testserver.cpp b/messagebus/src/vespa/messagebus/testlib/testserver.cpp index cdc7325c508..207ab2b83c2 100644 --- a/messagebus/src/vespa/messagebus/testlib/testserver.cpp +++ b/messagebus/src/vespa/messagebus/testlib/testserver.cpp @@ -70,7 +70,7 @@ TestServer::waitState(const SlobrokState &slobrokState) for (SlobrokState::ITR itr = slobrokState.begin(); itr != slobrokState.end(); ++itr) { - slobrok::api::MirrorAPI::SpecList res = net.getMirror().lookup(itr->first); + slobrok::api::IMirrorAPI::SpecList res = net.getMirror().lookup(itr->first); if (res.size() != itr->second) { done = false; } diff --git a/messagebus_test/src/tests/trace/trace.cpp b/messagebus_test/src/tests/trace/trace.cpp index f25c776ca74..a924d55195f 100644 --- a/messagebus_test/src/tests/trace/trace.cpp +++ b/messagebus_test/src/tests/trace/trace.cpp @@ -31,7 +31,7 @@ bool waitSlobrok(RPCMessageBus &mbus, const std::string &pattern) { for (int i = 0; i < 30000; i++) { - slobrok::api::MirrorAPI::SpecList res = mbus.getRPCNetwork().getMirror().lookup(pattern); + slobrok::api::IMirrorAPI::SpecList res = mbus.getRPCNetwork().getMirror().lookup(pattern); if (res.size() > 0) { return true; } diff --git a/slobrok/src/tests/mirrorapi/match_test.cpp b/slobrok/src/tests/mirrorapi/match_test.cpp index 874c39a6d3f..571748dfd28 100644 --- a/slobrok/src/tests/mirrorapi/match_test.cpp +++ b/slobrok/src/tests/mirrorapi/match_test.cpp @@ -9,6 +9,8 @@ class MatchTester : public slobrok::api::IMirrorAPI } virtual uint32_t updates() const override { return 0; } + virtual bool ready() const { return true; } + const std::string name; void testMatch(const char *n, const char *p, bool expected) diff --git a/slobrok/src/vespa/slobrok/imirrorapi.h b/slobrok/src/vespa/slobrok/imirrorapi.h new file mode 100644 index 00000000000..1995969e94a --- /dev/null +++ b/slobrok/src/vespa/slobrok/imirrorapi.h @@ -0,0 +1,67 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include <string> +#include <vector> + +namespace slobrok { +namespace api { + +/** + * @brief Defines an interface for the name server lookup. + **/ +class IMirrorAPI { +protected: + static bool match(const char *name, const char *pattern); + +public: + /** + * @brief Release any allocated resources. + **/ + virtual ~IMirrorAPI() { } + + /** + * @brief pair of <name, connectionspec>. + * + * The first element of pair is a string containing the service name. + * The second is the connection spec, typically "tcp/foo.bar.com:42" + **/ + typedef std::pair<std::string, std::string> Spec; + + /** + * @brief vector of <name, connectionspec> pairs. + * + * The first element of each pair is a string containing the service name. + * The second is the connection spec, typically "tcp/foo.bar.com:42" + **/ + typedef std::vector<Spec> SpecList; + + /** + * Obtain all the services matching a given pattern. + * + * The pattern is matched against all service names in the local mirror repository. A service name may contain '/' + * as a separator token. A pattern may contain '*' to match anything up to the next '/' (or the end of the + * name). This means that the pattern 'foo/<!-- slash-star -->*<!-- star-slash -->/baz' would match the service + * names 'foo/bar/baz' and 'foo/xyz/baz'. The pattern 'foo/b*' would match 'foo/bar', but neither 'foo/xyz' nor + * 'foo/bar/baz'. The pattern 'a*b' will never match anything. + * + * @return a list of all matching services, with corresponding connect specs + * @param pattern The pattern used for matching + **/ + virtual SpecList lookup(const std::string & pattern) const = 0; + + /** + * Obtain the number of updates seen by this mirror. The value may wrap, but will never become 0 again. This can be + * used for name lookup optimization, because the results returned by lookup() will never change unless this number + * also changes. + * + * @return number of slobrok updates seen + **/ + virtual uint32_t updates() const = 0; + + virtual bool ready() const = 0; +}; + +} // namespace api +} // namespace slobrok + diff --git a/slobrok/src/vespa/slobrok/sbmirror.h b/slobrok/src/vespa/slobrok/sbmirror.h index 7336e511d92..2193fee487f 100644 --- a/slobrok/src/vespa/slobrok/sbmirror.h +++ b/slobrok/src/vespa/slobrok/sbmirror.h @@ -1,72 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fnet/frt/frt.h> -#include <vespa/vespalib/util/gencnt.h> -#include <vespa/vespalib/util/sync.h> +#include "imirrorapi.h" #include "backoff.h" #include "sblist.h" #include "cfg.h" -#include <string> -#include <vector> +#include <vespa/fnet/frt/frt.h> +#include <vespa/vespalib/util/gencnt.h> +#include <vespa/vespalib/util/sync.h> namespace slobrok { namespace api { /** - * @brief Defines an interface for the name server lookup. - **/ -class IMirrorAPI { -protected: - static bool match(const char *name, const char *pattern); - -public: - /** - * @brief Release any allocated resources. - **/ - virtual ~IMirrorAPI() { } - - /** - * @brief pair of <name, connectionspec>. - * - * The first element of pair is a string containing the service name. - * The second is the connection spec, typically "tcp/foo.bar.com:42" - **/ - typedef std::pair<std::string, std::string> Spec; - - /** - * @brief vector of <name, connectionspec> pairs. - * - * The first element of each pair is a string containing the service name. - * The second is the connection spec, typically "tcp/foo.bar.com:42" - **/ - typedef std::vector<Spec> SpecList; - - /** - * Obtain all the services matching a given pattern. - * - * The pattern is matched against all service names in the local mirror repository. A service name may contain '/' - * as a separator token. A pattern may contain '*' to match anything up to the next '/' (or the end of the - * name). This means that the pattern 'foo/<!-- slash-star -->*<!-- star-slash -->/baz' would match the service - * names 'foo/bar/baz' and 'foo/xyz/baz'. The pattern 'foo/b*' would match 'foo/bar', but neither 'foo/xyz' nor - * 'foo/bar/baz'. The pattern 'a*b' will never match anything. - * - * @return a list of all matching services, with corresponding connect specs - * @param pattern The pattern used for matching - **/ - virtual SpecList lookup(const std::string & pattern) const = 0; - - /** - * Obtain the number of updates seen by this mirror. The value may wrap, but will never become 0 again. This can be - * used for name lookup optimization, because the results returned by lookup() will never change unless this number - * also changes. - * - * @return number of slobrok updates seen - **/ - virtual uint32_t updates() const = 0; -}; - -/** * @brief A MirrorAPI object is used to keep track of the services registered * with a slobrok cluster. * @@ -102,10 +48,10 @@ public: ~MirrorAPI(); // Inherit doc from IMirrorAPI. - SpecList lookup(const std::string & pattern) const; + SpecList lookup(const std::string & pattern) const override; // Inherit doc from IMirrorAPI. - uint32_t updates() const { return _updates.getAsInt(); } + uint32_t updates() const override { return _updates.getAsInt(); } /** * @brief Ask if the MirrorAPI has got any useful information from @@ -119,7 +65,7 @@ public: * @return true if the MirrorAPI object has * asked for updates from a Slobrok and got any answer back **/ - bool ready() const; + bool ready() const override; private: MirrorAPI(const MirrorAPI &); diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index d293df6bfc1..78d820c8802 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -18,6 +18,7 @@ #include <tests/common/dummystoragelink.h> #include <iostream> #include <chrono> +#include <thread> #include <vespa/metrics/metricmanager.h> LOG_SETUP(".test.metrics"); diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index c6fb4de4fb0..b8ce7d3cab5 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -11,6 +11,7 @@ #include <vespa/config-fleetcontroller.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/config/config.h> #include <vespa/log/log.h> LOG_SETUP(".test.servicelayerapp"); diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index cec059c0a8e..c9ae4be8069 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -26,6 +26,8 @@ #include <vespa/storageframework/storageframework.h> #include <vespa/storageapi/message/bucket.h> #include <unordered_set> +#include <vespa/config/subscription/configuri.h> + namespace storage { diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h index da3f6b4e352..01445529865 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h @@ -48,6 +48,7 @@ #include <vespa/vespalib/stllike/hash_map.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vdslib/state/nodestate.h> +#include <vespa/config/subscription/configuri.h> namespace storage { diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp index ab6346be167..da5bde76748 100644 --- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp +++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <iomanip> #include <vespa/storage/bucketmover/bucketmover.h> #include <vespa/storage/bucketmover/htmltable.h> diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.h b/storage/src/vespa/storage/bucketmover/bucketmover.h index da0d6e889b7..f2281b68848 100644 --- a/storage/src/vespa/storage/bucketmover/bucketmover.h +++ b/storage/src/vespa/storage/bucketmover/bucketmover.h @@ -24,6 +24,9 @@ #include <vespa/storageframework/storageframework.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/storage/common/servicelayercomponent.h> +#include <vespa/config/helper/ifetchercallback.h> +#include <vespa/config/subscription/configuri.h> +#include <vespa/config/config.h> namespace storage { diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index f0f7429f1fd..10a3c0bcf75 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -2,15 +2,12 @@ #include "statuswebserver.h" -#include <vespa/document/util/stringutil.h> -#include <vespa/log/log.h> -#include <map> -#include <sstream> #include <vespa/storageapi/message/persistence.h> #include <vespa/fastlib/net/url.h> #include <vespa/vespalib/util/host_name.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/vespalib/component/vtag.h> +#include <vespa/log/log.h> LOG_SETUP(".status"); diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h index c79c58d0d73..78c23f083f0 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h @@ -25,6 +25,9 @@ #include <vespa/storage/persistence/providershutdownwrapper.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storage/common/nodestateupdater.h> +#include <vespa/config/subscription/configuri.h> +#include <vespa/config/helper/ifetchercallback.h> +#include <vespa/config/config.h> namespace storage { namespace api { diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h index 7849d06b971..3b7838bb20c 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h @@ -10,6 +10,7 @@ #include <vespa/storage/persistence/types.h> #include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/sync.h> +#include <vespa/config/config.h> namespace storage { diff --git a/storage/src/vespa/storage/persistence/persistenceutil.cpp b/storage/src/vespa/storage/persistence/persistenceutil.cpp index 72e68d47182..0df12bdfb01 100644 --- a/storage/src/vespa/storage/persistence/persistenceutil.cpp +++ b/storage/src/vespa/storage/persistence/persistenceutil.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/persistence/persistenceutil.h> -#include <vespa/storage/persistence/filestorage/filestorhandler.h> -#include <vespa/storage/storageutil/utils.h> +#include "persistenceutil.h" +#include <vespa/config/config.h> #include <vespa/log/log.h> -#include <vespa/storage/bucketdb/storbucketdb.h> namespace storage { diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h index bbea3fab2a8..47173bedcda 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h @@ -15,7 +15,7 @@ #include <vespa/storage/config/config-stor-integritychecker.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageframework/storageframework.h> -#include <vespa/storageframework/storageframework.h> +#include <vespa/config/config.h> namespace storage { diff --git a/storage/src/vespa/storage/visiting/visitormanager.h b/storage/src/vespa/storage/visiting/visitormanager.h index 556a49e6227..aa9ecf37647 100644 --- a/storage/src/vespa/storage/visiting/visitormanager.h +++ b/storage/src/vespa/storage/visiting/visitormanager.h @@ -31,6 +31,7 @@ #include <vespa/storage/visiting/visitorthread.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storageframework/storageframework.h> +#include <vespa/config/config.h> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp index aa692ae2d57..d3778a171b6 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/message/bucketsplitting.h> + +#include "bucketsplitting.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/message/internal.cpp b/storageapi/src/vespa/storageapi/message/internal.cpp index ecc332cf6a2..f72dc2eb753 100644 --- a/storageapi/src/vespa/storageapi/message/internal.cpp +++ b/storageapi/src/vespa/storageapi/message/internal.cpp @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "internal.h" +#include <ostream> + namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/message/removelocation.cpp b/storageapi/src/vespa/storageapi/message/removelocation.cpp index e0c5d438b6e..bdf76e7d022 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.cpp +++ b/storageapi/src/vespa/storageapi/message/removelocation.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/message/removelocation.h> + +#include "removelocation.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/message/stat.cpp b/storageapi/src/vespa/storageapi/message/stat.cpp index 483060318b9..aae28580b5b 100644 --- a/storageapi/src/vespa/storageapi/message/stat.cpp +++ b/storageapi/src/vespa/storageapi/message/stat.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/message/stat.h> + +#include "stat.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/message/state.cpp b/storageapi/src/vespa/storageapi/message/state.cpp index 5b81ee72aa4..62cb83473c1 100644 --- a/storageapi/src/vespa/storageapi/message/state.cpp +++ b/storageapi/src/vespa/storageapi/message/state.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/message/state.h> +#include "state.h" #include <vespa/storageapi/messageapi/storagemessage.h> +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.cpp b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.cpp index 99736e7eaef..8b75df4ae32 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/messageapi/bucketinforeply.h> +#include "bucketinforeply.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketreply.cpp b/storageapi/src/vespa/storageapi/messageapi/bucketreply.cpp index 573d0e9fbbb..c95f54017e2 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketreply.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/bucketreply.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/messageapi/bucketreply.h> - -#include <vespa/storageapi/messageapi/bucketcommand.h> +#include "bucketreply.h" +#include "bucketcommand.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/storagereply.cpp b/storageapi/src/vespa/storageapi/messageapi/storagereply.cpp index b44cdba1765..cb511f379aa 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagereply.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/storagereply.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageapi/messageapi/storagereply.h> - -#include <vespa/storageapi/messageapi/storagecommand.h> +#include "storagereply.h" +#include "storagecommand.h" +#include <ostream> namespace storage { namespace api { diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp index 078298be9b6..7cd337a861b 100644 --- a/storageserver/src/tests/storageservertest.cpp +++ b/storageserver/src/tests/storageservertest.cpp @@ -1,22 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/storage/storageserver/servicelayernode.h> #include <vespa/storage/storageserver/distributornode.h> #include <vespa/document/base/testdocman.h> -#include <vespa/document/config/config-documenttypes.h> #include <vespa/documentapi/documentapi.h> #include <vespa/messagebus/rpcmessagebus.h> #include <fstream> -#include <vespa/log/log.h> #include <vespa/memfilepersistence/spi/memfilepersistenceprovider.h> #include <vespa/messagebus/staticthrottlepolicy.h> #include <vespa/messagebus/testlib/slobrok.h> #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> #include <vespa/storageapi/message/bucketsplitting.h> -#include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/state.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/common/statusmetricconsumer.h> @@ -24,10 +20,10 @@ #include <tests/testhelper.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <tests/dummystoragelink.h> - +#include <vespa/slobrok/sbmirror.h> #include <vespa/storageserver/app/distributorprocess.h> #include <vespa/storageserver/app/memfileservicelayerprocess.h> - +#include <vespa/log/log.h> LOG_SETUP(".storageservertest"); namespace storage { diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h index c67153b8dd2..997a55d00fc 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h @@ -5,6 +5,7 @@ #include <vespa/searchsummary/docsummary/juniperproperties.h> #include <vespa/storage/visiting/visitor.h> #include <vespa/config/retriever/simpleconfigurer.h> +#include <vespa/config/subscription/configuri.h> #include <vespa/vsm/vsm/vsm-adapter.h> #include "rankmanager.h" |