diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-18 04:56:51 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-19 14:15:44 +0000 |
commit | 6a33e844b93f483f09bca7cda744cae538209369 (patch) | |
tree | a5c004564ca5edf33686bc4c964106011b048d25 | |
parent | ef031ed8d62e86a7355200b6982682d39dee5032 (diff) |
Do not include fastos.h in header files.
15 files changed, 101 insertions, 59 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h index 2009e8b147b..2d13ea59991 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h @@ -1,7 +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/documentapi/messagebus/policies/storagepolicy.h> +#include "storagepolicy.h" namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp index 74d65d77eda..3a35e995805 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp @@ -1,15 +1,16 @@ // 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(".externpolicy"); - +#include "externpolicy.h" #include <boost/tokenizer.hpp> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/routing/route.h> #include <vespa/messagebus/routing/routingcontext.h> -#include "externpolicy.h" +#include <vespa/slobrok/sbmirror.h> +#include <vespa/fnet/frt/frt.h> + +#include <vespa/log/log.h> +LOG_SETUP(".externpolicy"); using slobrok::api::IMirrorAPI; using slobrok::api::MirrorAPI; @@ -21,7 +22,7 @@ namespace documentapi { ExternPolicy::ExternPolicy(const string ¶m) : _lock(), - _orb(), + _orb(std::make_unique<FRT_Supervisor>()), _mirror(), _pattern(), _session(), @@ -56,8 +57,8 @@ ExternPolicy::ExternPolicy(const string ¶m) : } slobrok::ConfiguratorFactory config(spec); - _mirror.reset(new MirrorAPI(_orb, config)); - _started = _orb.Start(); + _mirror.reset(new MirrorAPI(*_orb, config)); + _started = _orb->Start(); if (!_started) { _error = "Failed to start FNET supervisor."; return; @@ -82,7 +83,7 @@ ExternPolicy::~ExternPolicy() { _mirror.reset(); if (_started) { - _orb.ShutDown(true); + _orb->ShutDown(true); } } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h index f4a9157f8e3..629c3c861b8 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h @@ -1,13 +1,14 @@ // 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/messagebus/routing/hop.h> #include <vespa/messagebus/routing/iroutingpolicy.h> -#include <vespa/slobrok/sbmirror.h> -#include <string> +#include <vespa/slobrok/imirrorapi.h> #include <vector> #include <vespa/vespalib/util/sync.h> +#include <vespa/documentapi/common.h> + +class FRT_Supervisor; namespace documentapi { @@ -17,16 +18,17 @@ namespace documentapi { */ class ExternPolicy : public mbus::IRoutingPolicy { private: - vespalib::Lock _lock; - FRT_Supervisor _orb; - std::unique_ptr<slobrok::api::MirrorAPI> _mirror; - string _pattern; - string _session; - string _error; - uint32_t _offset; - uint32_t _gen; - std::vector<mbus::Hop> _recipients; - bool _started; + using IMirrorAPI = slobrok::api::IMirrorAPI; + vespalib::Lock _lock; + std::unique_ptr<FRT_Supervisor> _orb; + std::unique_ptr<IMirrorAPI> _mirror; + string _pattern; + string _session; + string _error; + uint32_t _offset; + uint32_t _gen; + std::vector<mbus::Hop> _recipients; + bool _started; private: /** @@ -71,7 +73,7 @@ public: * * @return The mirror pointer. */ - slobrok::api::MirrorAPI &getMirror() { return *_mirror; } + slobrok::api::IMirrorAPI &getMirror() { return *_mirror; } // Overrides IRoutingPolicy. void select(mbus::RoutingContext &ctx); diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.cpp index 1e3a46f6370..79726622a5f 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.cpp @@ -3,6 +3,8 @@ #include "externslobrokpolicy.h" #include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/messagebus/routing/routingcontext.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/slobrok/sbmirror.h> using slobrok::api::IMirrorAPI; using slobrok::api::MirrorAPI; @@ -12,6 +14,7 @@ namespace documentapi { ExternSlobrokPolicy::ExternSlobrokPolicy(const std::map<string, string>& param) : AsyncInitializationPolicy(param), _firstTry(true), + _orb(std::make_unique<FRT_Supervisor>()), _slobrokConfigId("admin/slobrok.0") { if (param.find("config") != param.end()) { @@ -42,24 +45,24 @@ ExternSlobrokPolicy::~ExternSlobrokPolicy() bool started = _mirror.get() != NULL; _mirror.reset(); if (started) { - _orb.ShutDown(true); + _orb->ShutDown(true); } } string ExternSlobrokPolicy::init() { if (_slobroks.size() != 0) { slobrok::ConfiguratorFactory config(_slobroks); - _mirror.reset(new MirrorAPI(_orb, config)); + _mirror.reset(new MirrorAPI(*_orb, config)); } else if (_configSources.size() != 0) { slobrok::ConfiguratorFactory config( config::ConfigUri(_slobrokConfigId, config::IConfigContext::SP( new config::ConfigContext(config::ServerSpec(_configSources))))); - _mirror.reset(new MirrorAPI(_orb, config)); + _mirror.reset(new MirrorAPI(*_orb, config)); } if (_mirror.get()) { - _orb.Start(); + _orb->Start(); } return ""; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h index a10b01ba42c..3686c5b6ca9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h @@ -4,8 +4,11 @@ #include <vespa/documentapi/messagebus/policies/asyncinitializationpolicy.h> #include <vespa/config-slobroks.h> #include <vespa/vdslib/distribution/distribution.h> -#include <vespa/slobrok/sbmirror.h> +#include <vespa/slobrok/imirrorapi.h> #include <vespa/documentapi/common.h> +#include <vespa/config/subscription/sourcespec.h> + +class FRT_Supervisor; namespace documentapi { @@ -17,12 +20,12 @@ class ExternSlobrokPolicy : public AsyncInitializationPolicy { protected: bool _firstTry; - config::ServerSpec::HostSpecList _configSources; - vespalib::Lock _lock; - FRT_Supervisor _orb; - std::unique_ptr<slobrok::api::MirrorAPI> _mirror; - slobrok::api::MirrorAPI::StringList _slobroks; - string _slobrokConfigId; + config::ServerSpec::HostSpecList _configSources; + vespalib::Lock _lock; + std::unique_ptr<FRT_Supervisor> _orb; + std::unique_ptr<slobrok::api::IMirrorAPI> _mirror; + std::vector<std::string> _slobroks; + string _slobrokConfigId; public: ExternSlobrokPolicy(const std::map<string, string>& params); @@ -32,9 +35,9 @@ public: * @return a pointer to the slobrok mirror owned by this policy, if any. * If the policy uses the default mirror API, NULL is returned. */ - const slobrok::api::MirrorAPI* getMirror() const { return _mirror.get(); } + const slobrok::api::IMirrorAPI* getMirror() const { return _mirror.get(); } - slobrok::api::MirrorAPI::SpecList lookup(mbus::RoutingContext &context, const string& pattern); + slobrok::api::IMirrorAPI::SpecList lookup(mbus::RoutingContext &context, const string& pattern); /** * Initializes the policy diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancer.h b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancer.h index a689b92730c..b94f7599623 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancer.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancer.h @@ -1,7 +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/imirrorapi.h> #include <vespa/documentapi/common.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp index fba1d648d23..5aaf7919d71 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp @@ -5,8 +5,11 @@ #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/routing/verbatimdirective.h> #include <vespa/documentapi/documentapi.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/config-stor-distribution.h> +#include <vespa/config/helper/ifetchercallback.h> +#include <vespa/config/helper/configfetcher.h> #include <vespa/log/log.h> LOG_SETUP(".storagepolicy"); diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h index f65ae964579..1b786a10696 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h @@ -1,12 +1,25 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "externslobrokpolicy.h" #include <vespa/document/bucket/bucketidfactory.h> #include <vespa/documentapi/messagebus/messages/wrongdistributionreply.h> #include <vespa/messagebus/reply.h> #include <vespa/vdslib/distribution/distribution.h> -#include <vespa/vdslib/state/clusterstate.h> -#include <vespa/documentapi/messagebus/policies/externslobrokpolicy.h> +#include <vespa/config/helper/ifetchercallback.h> +#include <vespa/config/helper/configfetcher.h> + +namespace config { + class ICallback; + class ConfigFetcher; +} + +namespace storage { +namespace lib { + class Distribution; + class ClusterState; +} +} namespace documentapi { diff --git a/messagebus/src/vespa/messagebus/network/oosmanager.h b/messagebus/src/vespa/messagebus/network/oosmanager.h index 32941e5a98f..e2606a25caa 100644 --- a/messagebus/src/vespa/messagebus/network/oosmanager.h +++ b/messagebus/src/vespa/messagebus/network/oosmanager.h @@ -1,13 +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/fnet/fnet.h> +#include <vespa/fnet/task.h> #include <set> #include <vespa/slobrok/imirrorapi.h> #include <string> #include <vespa/vespalib/util/sync.h> #include "oosclient.h" +class FRT_Supervisor; + namespace mbus { class RPCNetwork; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h index ed01dcdf6b3..7082a5636cc 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h @@ -5,7 +5,6 @@ #pragma once #include <vespa/config-summary.h> -#include <vespa/fnet/frt/frt.h> #include <vespa/searchlib/util/rawbuf.h> #include <vespa/searchlib/util/stringenum.h> #include <vespa/searchsummary/docsummary/resultclass.h> diff --git a/staging_vespalib/src/vespa/vespalib/util/timer.cpp b/staging_vespalib/src/vespa/vespalib/util/timer.cpp index 2e19de231e3..4a719e69665 100644 --- a/staging_vespalib/src/vespa/vespalib/util/timer.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/timer.cpp @@ -1,6 +1,6 @@ // 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 "timer.h" +#include <vespa/fnet/fnet.h> namespace vespalib { diff --git a/staging_vespalib/src/vespa/vespalib/util/timer.h b/staging_vespalib/src/vespa/vespalib/util/timer.h index 66584f69e10..963d6224fa0 100644 --- a/staging_vespalib/src/vespa/vespalib/util/timer.h +++ b/staging_vespalib/src/vespa/vespalib/util/timer.h @@ -4,7 +4,10 @@ #include <vespa/vespalib/util/linkedptr.h> #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/fnet/fnet.h> +#include <vespa/fastos/thread.h> +#include <vector> + +class FNET_Transport; namespace vespalib { diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index e9b7013d04a..369f2d1cf84 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -1,5 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "communicationmanager.h" +#include "fnetlistener.h" +#include "rpcrequestwrapper.h" #include <vespa/storageapi/message/state.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/storage/config/config-stor-server.h> @@ -71,6 +73,20 @@ PriorityQueue::size() return _queue.size(); } +StorageTransportContext::StorageTransportContext(std::unique_ptr<documentapi::DocumentMessage> msg) + : _docAPIMsg(std::move(msg)) +{ } + +StorageTransportContext::StorageTransportContext(std::unique_ptr<mbusprot::StorageCommand> msg) + : _storageProtocolMsg(std::move(msg)) +{ } + +StorageTransportContext::StorageTransportContext(std::unique_ptr<RPCRequestWrapper> request) + : _request(std::move(request)) +{ } + +StorageTransportContext::~StorageTransportContext() { } + const framework::MemoryAllocationType& CommunicationManager::getAllocationType(api::StorageMessage& msg) const { @@ -301,7 +317,7 @@ CommunicationManager::onOpen() framework::MilliSecTime maxProcessingTime(60 * 1000); _thread = _component.startThread(*this, maxProcessingTime); - if (_listener.get()) { + if (_listener) { _listener->registerHandle(_component.getIdentity()); } } @@ -344,7 +360,7 @@ void CommunicationManager::onClose() } } - if (_listener.get()) { + if (_listener) { _listener->close(); } diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 458e1b209d8..916a92247da 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -29,9 +29,7 @@ #include <vespa/storageapi/mbusprot/storagereply.h> #include <vespa/documentapi/documentapi.h> #include <vespa/storage/storageserver/communicationmanagermetrics.h> -#include <vespa/storage/storageserver/fnetlistener.h> #include <vespa/storage/storageserver/messageallocationtypes.h> -#include <vespa/storage/storageserver/rpcrequestwrapper.h> #include "documentapiconverter.h" #include <vespa/storageframework/storageframework.h> @@ -40,6 +38,8 @@ namespace storage { class VisitorMbusSession; class Visitor; class VisitorThread; +class FNetListener; +class RPCRequestWrapper; class PriorityQueue { private: @@ -110,14 +110,10 @@ public: class StorageTransportContext : public api::TransportContext { public: - StorageTransportContext(std::unique_ptr<documentapi::DocumentMessage> msg) - : _docAPIMsg(std::move(msg)) {}; - - StorageTransportContext(std::unique_ptr<mbusprot::StorageCommand> msg) - : _storageProtocolMsg(std::move(msg)) {}; - - StorageTransportContext(std::unique_ptr<RPCRequestWrapper> request) - : _request(std::move(request)) {}; + StorageTransportContext(std::unique_ptr<documentapi::DocumentMessage> msg); + StorageTransportContext(std::unique_ptr<mbusprot::StorageCommand> msg); + StorageTransportContext(std::unique_ptr<RPCRequestWrapper> request); + ~StorageTransportContext(); std::unique_ptr<documentapi::DocumentMessage> _docAPIMsg; std::unique_ptr<mbusprot::StorageCommand> _storageProtocolMsg; diff --git a/storage/src/vespa/storage/storageserver/fnetlistener.cpp b/storage/src/vespa/storage/storageserver/fnetlistener.cpp index 46558c6842a..ea66c7af894 100644 --- a/storage/src/vespa/storage/storageserver/fnetlistener.cpp +++ b/storage/src/vespa/storage/storageserver/fnetlistener.cpp @@ -1,8 +1,9 @@ // 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/fnetlistener.h> -#include <vespa/storage/storageserver/communicationmanager.h> +#include "fnetlistener.h" +#include "communicationmanager.h" +#include "rpcrequestwrapper.h" #include <vespa/storageapi/message/state.h> + #include <vespa/log/log.h> LOG_SETUP(".rpc.listener"); |