diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-05-31 16:45:36 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-05-31 16:45:36 +0200 |
commit | f16aff88ae81dbbaf189149096e9ebb902119b59 (patch) | |
tree | 32349ecda8542e5c7fd28d2427e227de6d5ec310 /storage | |
parent | 9924dcb71892a6f2bfd4ad4e796d6c19cd90603f (diff) |
Use forward declarations to avoid pulling in the whole world when it is not necessary.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp | 11 | ||||
-rw-r--r-- | storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h | 30 |
2 files changed, 23 insertions, 18 deletions
diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index 607a52630d7..b656c82c0c9 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.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 "statuswebserver.h" - +#include <vespa/storageframework/storageframework.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/fastlib/net/url.h> #include <vespa/vespalib/util/host_name.h> @@ -23,14 +23,14 @@ StatusWebServer::StatusWebServer( _httpServer(), _configFetcher(configUri.getContext()), _queuedRequests(), - _component(componentRegister, "Status"), + _component(std::make_unique<framework::Component>(componentRegister, "Status")), _thread() { _configFetcher.subscribe<vespa::config::content::core::StorStatusConfig>(configUri.getConfigId(), this); _configFetcher.start(); framework::MilliSecTime maxProcessingTime(60 * 60 * 1000); framework::MilliSecTime maxWaitTime(10 * 1000); - _thread = _component.startThread(*this, maxProcessingTime, maxWaitTime); + _thread = _component->startThread(*this, maxProcessingTime, maxWaitTime); } @@ -179,7 +179,7 @@ StatusWebServer::WebServer::onGetRequest(const string & tmpurl, const string &se _status._queuedRequests.emplace_back(new HttpRequest(url.c_str(), urlpath.getServerSpec())); HttpRequest* req = _status._queuedRequests.back().get(); framework::SecondTime timeout(urlpath.get("timeout", 30u)); - framework::SecondTime timeoutTime(_status._component.getClock().getTimeInSeconds() + timeout); + framework::SecondTime timeoutTime(_status._component->getClock().getTimeInSeconds() + timeout); monitor.signal(); while (true) { monitor.wait(100); @@ -189,8 +189,7 @@ StatusWebServer::WebServer::onGetRequest(const string & tmpurl, const string &se LOG(debug, "Finished status request for '%s'", req->_url.c_str()); done = true; } else { - if (_status._component.getClock().getTimeInSeconds() - > timeoutTime) + if (_status._component->getClock().getTimeInSeconds() > timeoutTime) { std::ostringstream ost; { diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index 2fde5e98ef6..f3abeb2d84a 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -11,7 +11,7 @@ #pragma once #include <vespa/storage/config/config-stor-status.h> -#include <vespa/storageframework/storageframework.h> +#include <vespa/storageframework/generic/thread/runnable.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> #include <vespa/fastlib/net/httpserver.h> @@ -19,6 +19,14 @@ namespace storage { +namespace framework { + class StatusReporterMap; + class ThreadHandle; + class ComponentRegister; + class Thread; + class HttpUrlPath; + class Component; +} class StatusWebServer : private config::IFetcherCallback<vespa::config::content::core::StorStatusConfig>, private framework::Runnable { @@ -29,9 +37,7 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: public: WebServer(StatusWebServer&, uint16_t port); - void onGetRequest(const string & url, - const string & serverSpec, - Fast_HTTPConnection& conn) override; + void onGetRequest(const string & url, const string & serverSpec, Fast_HTTPConnection& conn) override; const vespalib::string &getServerSpec() const { return _serverSpec; } @@ -50,14 +56,14 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: {} }; - framework::StatusReporterMap& _reporterMap; - vespalib::Monitor _workerMonitor; - uint16_t _port; - std::unique_ptr<WebServer> _httpServer; - config::ConfigFetcher _configFetcher; - std::list<HttpRequest::SP> _queuedRequests; - framework::Component _component; - framework::Thread::UP _thread; + framework::StatusReporterMap& _reporterMap; + vespalib::Monitor _workerMonitor; + uint16_t _port; + std::unique_ptr<WebServer> _httpServer; + config::ConfigFetcher _configFetcher; + std::list<HttpRequest::SP> _queuedRequests; + std::unique_ptr<framework::Component> _component; + std::unique_ptr<framework::Thread> _thread; public: StatusWebServer(const StatusWebServer &) = delete; |