summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp11
-rw-r--r--storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h30
-rw-r--r--storageframework/src/vespa/storageframework/generic/component/component.h7
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/runnable.h7
4 files changed, 27 insertions, 28 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;
diff --git a/storageframework/src/vespa/storageframework/generic/component/component.h b/storageframework/src/vespa/storageframework/generic/component/component.h
index 5ce86292f7d..95096e23653 100644
--- a/storageframework/src/vespa/storageframework/generic/component/component.h
+++ b/storageframework/src/vespa/storageframework/generic/component/component.h
@@ -74,8 +74,7 @@
#include <vespa/vespalib/util/sync.h>
#include <atomic>
-namespace storage {
-namespace framework {
+namespace storage::framework {
class ComponentRegister;
@@ -217,6 +216,4 @@ public:
};
-} // framework
-} // storage
-
+}
diff --git a/storageframework/src/vespa/storageframework/generic/thread/runnable.h b/storageframework/src/vespa/storageframework/generic/thread/runnable.h
index 0e6186b546a..f7b295d785b 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/runnable.h
+++ b/storageframework/src/vespa/storageframework/generic/thread/runnable.h
@@ -11,8 +11,7 @@
#include <vespa/storageframework/generic/clock/time.h>
-namespace storage {
-namespace framework {
+namespace storage::framework {
/**
* A cycle type can be given when registering ticks. This is useful for
@@ -63,6 +62,4 @@ struct Runnable {
virtual void run(ThreadHandle&) = 0;
};
-} // framework
-} // storage
-
+} // storage::framework