diff options
467 files changed, 2085 insertions, 4205 deletions
diff --git a/config/src/apps/configproxy-cmd/main.cpp b/config/src/apps/configproxy-cmd/main.cpp index fcf2a0ca5d7..1d5934f2817 100644 --- a/config/src/apps/configproxy-cmd/main.cpp +++ b/config/src/apps/configproxy-cmd/main.cpp @@ -10,8 +10,8 @@ class Application : public FastOS_Application Flags _flags; bool parseOpts(); public: - void usage(void); - int Main(void) override; + void usage(); + int Main() override; Application() : _flags() {} }; diff --git a/config/src/apps/getvespaconfig/getconfig.cpp b/config/src/apps/getvespaconfig/getconfig.cpp index 23127b79333..df7bbba48b0 100644 --- a/config/src/apps/getvespaconfig/getconfig.cpp +++ b/config/src/apps/getvespaconfig/getconfig.cpp @@ -32,7 +32,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main() override; + int Main() override; }; diff --git a/config/src/apps/pingproxy/pingproxy.cpp b/config/src/apps/pingproxy/pingproxy.cpp index 667d5689691..ba35892c03c 100644 --- a/config/src/apps/pingproxy/pingproxy.cpp +++ b/config/src/apps/pingproxy/pingproxy.cpp @@ -24,7 +24,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main() override; + int Main() override; }; diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp index 91b657b42f2..0693c33467d 100644 --- a/config/src/tests/configagent/configagent.cpp +++ b/config/src/tests/configagent/configagent.cpp @@ -1,5 +1,4 @@ // 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/vespalib/testkit/test_kit.h> #include <vespa/config/config.h> #include <vespa/config/raw/rawsource.h> @@ -19,25 +18,10 @@ public: : _key(key) { } - const ConfigKey & getKey() const override - { - return _key; - } - - bool abort() override - { - return false; - } - - bool isAborted() const override - { - return false; - } - - void setError(int errorCode) override - { - (void) errorCode; - } + const ConfigKey & getKey() const override { return _key; } + bool abort() override { return false; } + bool isAborted() const override { return false; } + void setError(int errorCode) override { (void) errorCode; } const ConfigKey _key; }; @@ -57,51 +41,15 @@ public: _isError(iserror) { } - const ConfigKey& getKey() const override - { - return _key; - } - - const ConfigValue & getValue() const override - { - return _value; - } - - const ConfigState & getConfigState() const override - { - return _state; - } - - bool hasValidResponse() const override - { - return _valid; - } - - bool validateResponse() override - { - return _valid; - } - - void fill() override - { - _fillCalled = true; - } - - vespalib::string errorMessage() const override - { - return _errorMessage; - } - - int errorCode() const override - { - return _errorCode; - } - - bool isError() const override - { - return _isError; - } - + const ConfigKey& getKey() const override { return _key; } + const ConfigValue & getValue() const override { return _value; } + const ConfigState & getConfigState() const override { return _state; } + bool hasValidResponse() const override { return _valid; } + bool validateResponse() override { return _valid; } + void fill() override { _fillCalled = true; } + vespalib::string errorMessage() const override { return _errorMessage; } + int errorCode() const override { return _errorCode; } + bool isError() const override { return _isError; } const Trace & getTrace() const override { return _trace; } const ConfigKey _key; diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp index bb4dda0e10e..8273eee2c73 100644 --- a/config/src/tests/configretriever/configretriever.cpp +++ b/config/src/tests/configretriever/configretriever.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("configretriever"); + #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/config/config.h> diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index 26f95df8f42..0de1908858f 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("frt"); + #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/config/common/iconfigholder.h> #include <vespa/config/common/trace.h> diff --git a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp index 96dad86a54d..b563ea1929b 100644 --- a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp +++ b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("frtconnectionpool_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/frt/frtconnectionpool.h> #include <vespa/fnet/frt/error.h> diff --git a/config/src/tests/subscription/subscription.cpp b/config/src/tests/subscription/subscription.cpp index e47f8b11e60..5974279518a 100644 --- a/config/src/tests/subscription/subscription.cpp +++ b/config/src/tests/subscription/subscription.cpp @@ -1,5 +1,4 @@ // 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/vespalib/testkit/test_kit.h> #include <vespa/config/common/misc.h> #include <vespa/config/common/configholder.h> diff --git a/config/src/tests/trace/trace.cpp b/config/src/tests/trace/trace.cpp index 566077d47e1..195f7d659a9 100644 --- a/config/src/tests/trace/trace.cpp +++ b/config/src/tests/trace/trace.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("frt"); + #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/config/common/trace.h> #include <vespa/vespalib/trace/tracenode.h> diff --git a/config/src/vespa/config/helper/ifetchercallback.h b/config/src/vespa/config/helper/ifetchercallback.h index 9bc6e848827..50c26f2d3fc 100644 --- a/config/src/vespa/config/helper/ifetchercallback.h +++ b/config/src/vespa/config/helper/ifetchercallback.h @@ -26,14 +26,11 @@ public: template <typename ConfigType> class IFetcherCallback : public ICallback { -public: - virtual ~IFetcherCallback() { } protected: - virtual void configure(std::unique_ptr<const ConfigInstance> config) override { + void configure(std::unique_ptr<const ConfigInstance> config) override { configure(std::unique_ptr<ConfigType>(static_cast<const ConfigType *>(config.release()))); } virtual void configure(std::unique_ptr<ConfigType> config) = 0; }; } // namespace config - diff --git a/configd/src/tests/messages/messages.cpp b/configd/src/tests/messages/messages.cpp index 46fa229ff29..a8b2e37af36 100644 --- a/configd/src/tests/messages/messages.cpp +++ b/configd/src/tests/messages/messages.cpp @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -#include <vespa/vespalib/testkit/testapp.h> -LOG_SETUP("messages_test"); +#include <vespa/vespalib/testkit/testapp.h> class MessagesTest : public vespalib::TestApp { diff --git a/configutil/src/apps/configstatus/main.cpp b/configutil/src/apps/configstatus/main.cpp index f774afa355d..4583af033c2 100644 --- a/configutil/src/apps/configstatus/main.cpp +++ b/configutil/src/apps/configstatus/main.cpp @@ -17,8 +17,8 @@ class Application : public FastOS_Application { vespalib::string getSources(); HostFilter parse_host_set(vespalib::stringref raw_arg) const; public: - void usage(void); - int Main(void) override; + void usage(); + int Main() override; Application(); ~Application(); diff --git a/configutil/src/lib/configstatus.cpp b/configutil/src/lib/configstatus.cpp index 174350c5eca..5a876a30ab5 100644 --- a/configutil/src/lib/configstatus.cpp +++ b/configutil/src/lib/configstatus.cpp @@ -9,9 +9,6 @@ #include <vbench/http/http_client.h> #include <iostream> -#include <vespa/log/log.h> -LOG_SETUP("vespa-config-status"); - using configdefinitions::tagsContain; struct ComponentTraverser : public vespalib::slime::ObjectTraverser @@ -41,8 +38,7 @@ struct ComponentTraverser : public vespalib::slime::ObjectTraverser slime.get()["config"].traverse(traverser); } - virtual void - field(const vespalib::Memory &symbol_name, const vespalib::slime::Inspector &inspector) override { + void field(const vespalib::Memory &symbol_name, const vespalib::slime::Inspector &inspector) override { switch (_state) { case ROOT: _component = symbol_name.make_string(); @@ -87,16 +83,16 @@ public: {} ~MyHttpHandler(); - virtual void handleHeader(const vbench::string &name, const vbench::string &value) override { + void handleHeader(const vbench::string &name, const vbench::string &value) override { (void) name; (void) value; } - virtual void handleContent(const vbench::Memory &data) override { + void handleContent(const vbench::Memory &data) override { _json += std::string(data.data, data.size); } - virtual void handleFailure(const vbench::string &reason) override { + void handleFailure(const vbench::string &reason) override { std::cerr << _configId << ": Failed to fetch json: " << reason << std::endl; _error = reason; } diff --git a/configutil/src/tests/config_status/config_status_test.cpp b/configutil/src/tests/config_status/config_status_test.cpp index 77fcf1b8da8..39442068330 100644 --- a/configutil/src/tests/config_status/config_status_test.cpp +++ b/configutil/src/tests/config_status/config_status_test.cpp @@ -1,14 +1,10 @@ // 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/vespalib/testkit/testapp.h> #include <lib/configstatus.h> -#include <iostream> #include <vespa/fastlib/net/httpserver.h> #include <vespa/config-model.h> #include <vespa/config/config.h> #include <vespa/config/subscription/sourcespec.h> -#include <vector> -#include <string> using namespace config; @@ -17,8 +13,7 @@ private: std::string _reply; bool _fail; - virtual void onGetRequest(const string &, const string &, - Fast_HTTPConnection &conn) override { + void onGetRequest(const string &, const string &, Fast_HTTPConnection &conn) override { if (_fail) { conn.Output(conn.GetHTTPVersion().c_str()); conn.Output(" 500 Error\r\n"); diff --git a/configutil/src/tests/model_inspect/model_inspect_test.cpp b/configutil/src/tests/model_inspect/model_inspect_test.cpp index be45d4d0d46..fe818e8e4e4 100644 --- a/configutil/src/tests/model_inspect/model_inspect_test.cpp +++ b/configutil/src/tests/model_inspect/model_inspect_test.cpp @@ -1,8 +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/vespalib/testkit/test_kit.h> #include <lib/modelinspect.h> -#include <iostream> +#include <sstream> class Model { public: @@ -89,11 +88,11 @@ public: void listServices() override { _listServices = true; }; void listClusters() override { _listClusters = true; }; void listConfigIds() override { _listConfigIds = true; }; - int listHost(const vespalib::string) override { _listHost = true; return 0; }; + int listHost(const vespalib::string) override { _listHost = true; return 0; }; int listAllPorts() override { _listAllPorts = true; return 0; }; - int listCluster(const vespalib::string) override { _listCluster = true; return 0; }; - int listService(const vespalib::string) override { _listService = true; return 0; }; - int listService(const vespalib::string, const vespalib::string) override { _listService2 = true; return 0; }; + int listCluster(const vespalib::string) override { _listCluster = true; return 0; }; + int listService(const vespalib::string) override { _listService = true; return 0; }; + int listService(const vespalib::string, const vespalib::string) override { _listService2 = true; return 0; }; int listConfigId(const vespalib::string) override { _listConfigId = true; return 0; }; int getIndexOf(const vespalib::string, const vespalib::string) override { _getIndexOf = true; return 0; }; diff --git a/document/src/tests/arrayfieldvaluetest.cpp b/document/src/tests/arrayfieldvaluetest.cpp index 85659c0cbb4..7f31e0c3b3a 100644 --- a/document/src/tests/arrayfieldvaluetest.cpp +++ b/document/src/tests/arrayfieldvaluetest.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 <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/vdstestlib/cppunit/macros.h> @@ -11,9 +10,6 @@ using vespalib::nbostream; namespace document { struct ArrayFieldValueTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testArray(); CPPUNIT_TEST_SUITE(ArrayFieldValueTest); diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp index 8e17dd12e12..6957634cbde 100644 --- a/document/src/tests/documentselectparsertest.cpp +++ b/document/src/tests/documentselectparsertest.cpp @@ -1,17 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//#include <boost/regex/icu.hpp> -#include <vespa/fastos/fastos.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include <vespa/document/repo/configbuilder.h> #include <vespa/document/repo/documenttyperepo.h> -#include <iostream> -#include <memory> #include <vespa/document/update/assignvalueupdate.h> #include <vespa/document/base/testdocman.h> -#include <vespa/document/base/testdocrepo.h> #include <vespa/document/select/parser.h> #include <vespa/document/select/visitor.h> #include <vespa/document/select/bodyfielddetector.h> @@ -66,7 +61,6 @@ public: : _bucketIdFactory() {} void setUp() override; - void tearDown() override {} void createDocs(); void testParseTerminals(); @@ -912,32 +906,27 @@ namespace { std::ostringstream data; public: - virtual ~TestVisitor() {} + ~TestVisitor() {} - void visitConstant(const select::Constant& node) override - { + void visitConstant(const select::Constant& node) override { data << "CONSTANT(" << node << ")"; } - virtual void - visitInvalidConstant(const select::InvalidConstant& node) override - { + void + visitInvalidConstant(const select::InvalidConstant& node) override { data << "INVALIDCONSTANT(" << node << ")"; } - void visitDocumentType(const select::DocType& node) override - { + void visitDocumentType(const select::DocType& node) override { data << "DOCTYPE(" << node << ")"; } - void visitComparison(const select::Compare& node) override - { + void visitComparison(const select::Compare& node) override { data << "COMPARE(" << node.getLeft() << " " << node.getOperator() << " " << node.getRight() << ")"; } - void visitAndBranch(const select::And& node) override - { + void visitAndBranch(const select::And& node) override { data << "AND("; node.getLeft().visit(*this); data << ", "; @@ -945,8 +934,7 @@ namespace { data << ")"; } - void visitOrBranch(const select::Or& node) override - { + void visitOrBranch(const select::Or& node) override { data << "OR("; node.getLeft().visit(*this); data << ", "; @@ -954,72 +942,24 @@ namespace { data << ")"; } - void visitNotBranch(const select::Not& node) override - { + void visitNotBranch(const select::Not& node) override { data << "NOT("; node.getChild().visit(*this); data << ")"; } - virtual void - visitArithmeticValueNode(const select::ArithmeticValueNode &) override - { - } - - virtual void - visitFunctionValueNode(const select::FunctionValueNode &) override - { - } - - virtual void - visitIdValueNode(const select::IdValueNode &) override - { - } - - virtual void - visitSearchColumnValueNode(const select::SearchColumnValueNode &) override - { - } - - virtual void - visitFieldValueNode(const select::FieldValueNode &) override - { - } - - virtual void - visitFloatValueNode(const select::FloatValueNode &) override - { - } - - virtual void - visitVariableValueNode(const select::VariableValueNode &) override - { - } - - virtual void - visitIntegerValueNode(const select::IntegerValueNode &) override - { - } - - virtual void - visitCurrentTimeValueNode(const select::CurrentTimeValueNode &) override - { - } - - virtual void - visitStringValueNode(const select::StringValueNode &) override - { - } - - virtual void - visitNullValueNode(const select::NullValueNode &) override - { - } - - virtual void - visitInvalidValueNode(const select::InvalidValueNode &) override - { - } + void visitArithmeticValueNode(const select::ArithmeticValueNode &) override {} + void visitFunctionValueNode(const select::FunctionValueNode &) override {} + void visitIdValueNode(const select::IdValueNode &) override {} + void visitSearchColumnValueNode(const select::SearchColumnValueNode &) override {} + void visitFieldValueNode(const select::FieldValueNode &) override {} + void visitFloatValueNode(const select::FloatValueNode &) override {} + void visitVariableValueNode(const select::VariableValueNode &) override {} + void visitIntegerValueNode(const select::IntegerValueNode &) override {} + void visitCurrentTimeValueNode(const select::CurrentTimeValueNode &) override {} + void visitStringValueNode(const select::StringValueNode &) override {} + void visitNullValueNode(const select::NullValueNode &) override {} + void visitInvalidValueNode(const select::InvalidValueNode &) override {} std::string getVisitString() { return data.str(); } }; diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 5ac7c48c7ad..baa777ceca1 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -33,8 +33,6 @@ using vespalib::tensor::TensorDimensions; namespace document { struct DocumentUpdateTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} void testSimpleUsage(); void testUpdateApplySingleValue(); diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp index ba81e0ebbf6..15fd6e00959 100644 --- a/document/src/tests/primitivefieldvaluetest.cpp +++ b/document/src/tests/primitivefieldvaluetest.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 <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/vdstestlib/cppunit/macros.h> @@ -11,8 +10,6 @@ using vespalib::nbostream; namespace document { struct PrimitiveFieldValueTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} void testLiterals(); void testRaw(); diff --git a/document/src/tests/serialization/annotationserializer_test.cpp b/document/src/tests/serialization/annotationserializer_test.cpp index 9be0d6d334e..49860df128d 100644 --- a/document/src/tests/serialization/annotationserializer_test.cpp +++ b/document/src/tests/serialization/annotationserializer_test.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Unit tests for annotation serialization. #include <vespa/document/base/testdocrepo.h> #include <vespa/document/annotation/alternatespanlist.h> diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp index 0daf8c97302..d6e585e0987 100644 --- a/document/src/tests/structfieldvaluetest.cpp +++ b/document/src/tests/structfieldvaluetest.cpp @@ -17,8 +17,6 @@ namespace document { struct StructFieldValueTest : public CppUnit::TestFixture { DocumentTypeRepo doc_repo; StructFieldValueTest(); - void setUp() override {} - void tearDown() override {} void testStruct(); void testEmptyStruct(); diff --git a/document/src/tests/testrunner.cpp b/document/src/tests/testrunner.cpp index aabdbb3f605..815476a3f41 100644 --- a/document/src/tests/testrunner.cpp +++ b/document/src/tests/testrunner.cpp @@ -1,13 +1,12 @@ // 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> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("documentcppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/document/src/tests/teststringutil.h b/document/src/tests/teststringutil.h index 355d90367ed..cba15682d7e 100644 --- a/document/src/tests/teststringutil.h +++ b/document/src/tests/teststringutil.h @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/* $Id$*/ - #pragma once #include <cppunit/extensions/HelperMacros.h> diff --git a/document/src/tests/weightedsetfieldvaluetest.cpp b/document/src/tests/weightedsetfieldvaluetest.cpp index 100db297b55..81b98da297f 100644 --- a/document/src/tests/weightedsetfieldvaluetest.cpp +++ b/document/src/tests/weightedsetfieldvaluetest.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 <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/vdstestlib/cppunit/macros.h> @@ -11,8 +10,6 @@ using vespalib::nbostream; namespace document { struct WeightedSetFieldValueTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} void testWeightedSet(); void testAddIgnoreZeroWeight(); diff --git a/documentapi/src/tests/loadtypes/testrunner.cpp b/documentapi/src/tests/loadtypes/testrunner.cpp index 71200f84224..bdcdcdab944 100644 --- a/documentapi/src/tests/loadtypes/testrunner.cpp +++ b/documentapi/src/tests/loadtypes/testrunner.cpp @@ -1,12 +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> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storagecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/documentapi/src/tests/policies/testframe.cpp b/documentapi/src/tests/policies/testframe.cpp index 8d5b6585529..db8a1b48924 100644 --- a/documentapi/src/tests/policies/testframe.cpp +++ b/documentapi/src/tests/policies/testframe.cpp @@ -1,7 +1,4 @@ // 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(".testframe"); #include "testframe.h" #include <vespa/messagebus/emptyreply.h> @@ -11,6 +8,9 @@ LOG_SETUP(".testframe"); #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/testlib/simplereply.h> +#include <vespa/log/log.h> +LOG_SETUP(".testframe"); + using document::DocumentTypeRepo; using namespace documentapi; diff --git a/documentapi/src/tests/policies/testframe.h b/documentapi/src/tests/policies/testframe.h index e0780733331..f0e37d979f3 100644 --- a/documentapi/src/tests/policies/testframe.h +++ b/documentapi/src/tests/policies/testframe.h @@ -197,8 +197,6 @@ public: * @return Handle to the system state. */ documentapi::SystemStateHandle getSystemState(); - - // Implements IReplyHandler. void handleReply(mbus::Reply::UP reply) override; }; diff --git a/documentapi/src/tests/replymerger/replymerger_test.cpp b/documentapi/src/tests/replymerger/replymerger_test.cpp index 8803994b0cf..b26290e0bcd 100644 --- a/documentapi/src/tests/replymerger/replymerger_test.cpp +++ b/documentapi/src/tests/replymerger/replymerger_test.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("replymerger_test"); -#include <vespa/fastos/fastos.h> #include <iostream> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/documentapi/messagebus/replymerger.h> diff --git a/documentapi/src/tests/routablefactory/routablefactory.cpp b/documentapi/src/tests/routablefactory/routablefactory.cpp index 620142e803b..b4449891af2 100644 --- a/documentapi/src/tests/routablefactory/routablefactory.cpp +++ b/documentapi/src/tests/routablefactory/routablefactory.cpp @@ -1,5 +1,4 @@ // 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/document/repo/documenttyperepo.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/routablefactories51.h> diff --git a/documentapi/src/tests/systemstate/systemstate.cpp b/documentapi/src/tests/systemstate/systemstate.cpp index a797f55c625..e3163937a3f 100644 --- a/documentapi/src/tests/systemstate/systemstate.cpp +++ b/documentapi/src/tests/systemstate/systemstate.cpp @@ -1,12 +1,12 @@ // 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("systemstate_test"); #include <vespa/documentapi/messagebus/systemstate/systemstate.h> #include <vespa/documentapi/messagebus/systemstate/systemstatehandle.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("systemstate_test"); + using namespace documentapi; class Test : public vespalib::TestApp { diff --git a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h index b35cce81b40..e1c2b7f4f35 100644 --- a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h +++ b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h @@ -303,17 +303,9 @@ public: * @return The system state. */ SystemState &getSystemState() { return *_systemState; } - - // Implements IProtocol. const mbus::string &getName() const override { return NAME; } - - // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string &name, const mbus::string ¶m) const override; - - // Implements IProtocol. mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const override; - - // Implements IProtocol. mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef data) const override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h index b4adf41ca79..2887c8435e1 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h @@ -82,7 +82,6 @@ public: _approxSize = approxSize; } - // Implements mbus::Message. const mbus::string& getProtocol() const override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h index 2850c412807..69563bcc63b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h @@ -32,7 +32,7 @@ public: /** * Virtual destructor required for inheritance. */ - virtual ~DocumentReply() { } + ~DocumentReply() { } /** * Returns the priority tag for this message. This is an optional tag added for VDS that is not interpreted by the @@ -41,7 +41,6 @@ public: * @return The priority. */ Priority::Value getPriority() const { return _priority; } - uint8_t priority() const override { return (uint8_t)_priority; } /** @@ -50,13 +49,8 @@ public: * @param priority The priority to set. */ void setPriority(Priority::Value p) { _priority = p; } - - // Implements mbus::Reply. const mbus::string& getProtocol() const override; - - // Implements mbus::Reply. uint32_t getType() const override { return _type; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h index ac5e141da23..0c9c8b09a0c 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> namespace documentapi { @@ -30,15 +30,9 @@ public: * @param summary The document summary to contain. */ DocumentSummaryMessage(const vdslib::DocumentSummary &summary); - - // Overrides VisitorMessage. uint32_t getApproxSize() const override; - - // Implements VisitorMessage. uint32_t getType() const override; - string toString() const override { return "documentsummarymessage"; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h index 54ce4e8de4c..bd1805a4a17 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> namespace documentapi { @@ -21,18 +21,14 @@ protected: public: EmptyBucketsMessage(); // must be serialized into - EmptyBucketsMessage(const std::vector<document::BucketId> &bucketIds); std::vector<document::BucketId> &getBucketIds() { return _bucketIds; } const std::vector<document::BucketId> &getBucketIds() const { return _bucketIds; } void setBucketIds(const std::vector<document::BucketId> &bucketIds); - void resize(uint32_t size); - uint32_t getType() const override; - string toString() const override { return "emptybucketsmessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h index c08e36aa3fd..2e1e92652d9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h @@ -40,18 +40,10 @@ public: * @param id The bucket id to set. */ void setBucketId(const document::BucketId& id) { _bucketId = id; } - - // Overrides DocumentMessage. bool hasSequenceId() const override; - - // Overrides DocumentMessage. uint64_t getSequenceId() const override; - - // Implements DocumentMessage. uint32_t getType() const override; - string toString() const override { return "getbucketlistmessage"; } }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h index a207ef206e4..0b7df089bce 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.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/messages/documentreply.h> +#include "documentreply.h" #include <vespa/document/bucket/bucketid.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h index ed27ed11212..62129a79003 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "documentmessage.h" #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/documentmessage.h> namespace documentapi { @@ -40,16 +40,9 @@ public: * @param bucket The bucket id to set. */ void setBucketId(document::BucketId bucket) { _bucket = bucket; } - - // Overrides DocumentMessage. bool hasSequenceId() const override; - - // Overrides DocumentMessage. uint64_t getSequenceId() const override; - - // Implements DocumentMessage. uint32_t getType() const override; - string toString() const override { return "getbucketstatemessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h index ac78aea6251..4c6f8bf9de7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" +#include "documentreply.h" #include <vespa/vdslib/container/parameters.h> #include <vespa/vdslib/container/documentlist.h> #include <vespa/vdslib/container/operationlist.h> #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/visitor.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/documentprotocol.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h index 46af0dfb7a4..4537da0fb6e 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "testandsetmessage.h" #include <vespa/document/fieldvalue/document.h> -#include <vespa/documentapi/messagebus/messages/testandsetmessage.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h index 3904cf0f243..a47e35f3098 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "testandsetmessage.h" #include <vespa/document/base/documentid.h> -#include <vespa/documentapi/messagebus/messages/testandsetmessage.h> namespace documentapi { diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h index acaf3357d4d..ce15fe4eda0 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.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/messages/documentmessage.h> +#include "documentmessage.h" #include <vespa/document/bucket/bucketid.h> #include <vespa/document/bucket/bucketselector.h> #include <vespa/document/select/parser.h> @@ -17,13 +17,9 @@ public: RemoveLocationMessage(const document::BucketIdFactory& factory, document::select::Parser& parser, const string& documentSelection); const string& getDocumentSelection() const { return _documentSelection; } - - uint32_t getType() const override; - const document::BucketId& getBucketId() const { return _bucketId; }; - + uint32_t getType() const override; string toString() const override { return "removelocationmessage"; } - protected: DocumentReply::UP doCreateReply() const override; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h index 43045fd44c6..ce30be3ecc2 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h @@ -1,20 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @file persistence.h - * - * Persistence related commands, like put, get & remove - */ + #pragma once +#include "writedocumentreply.h" +#include "documentmessage.h" +#include "documentreply.h" #include <vespa/vdslib/container/parameters.h> #include <vespa/vdslib/container/documentlist.h> #include <vespa/vdslib/container/visitorstatistics.h> #include <vespa/document/bucket/bucketid.h> -#include <vespa/documentapi/messagebus/messages/documentmessage.h> -#include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/document/select/orderingspecification.h> -#include <vespa/documentapi/messagebus/messages/writedocumentreply.h> namespace documentapi { @@ -139,14 +135,12 @@ public: typedef std::unique_ptr<DestroyVisitorMessage> UP; DestroyVisitorMessage(); // must be deserialized into - DestroyVisitorMessage(const string &instanceId); const string& getInstanceId() const { return _instanceId; } void setInstanceId(const string& id) { _instanceId = id; } uint32_t getType() const override; - string toString() const override { return "destroyvisitormessage"; } }; @@ -214,7 +208,6 @@ public: void setErrorMessage(const string& errorMessage) { _errorMessage = errorMessage; }; uint32_t getType() const override; - string toString() const override { return "visitorinfomessage"; } }; @@ -241,7 +234,6 @@ public: uint32_t getApproxSize() const override; uint32_t getType() const override; - string toString() const override { return "mapvisitormessage"; } }; @@ -256,12 +248,9 @@ public: class Entry { public: Entry(); - Entry(int64_t timestamp, - document::Document::SP doc, - bool removeEntry); + Entry(int64_t timestamp, document::Document::SP doc, bool removeEntry); Entry(const Entry& other); - Entry(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buf); + Entry(const document::DocumentTypeRepo &repo, document::ByteBuffer& buf); int64_t getTimestamp() { return _timestamp; } const document::Document::SP& getDocument() { return _document; } @@ -293,7 +282,6 @@ public: const std::vector<Entry>& getDocuments() const { return _documents; }; uint32_t getType() const override; - string toString() const override { return "documentlistmessage"; } }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h index 0edba2c0872..a5dc1872e44 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vector> #include <vespa/messagebus/routing/hop.h> #include <vespa/messagebus/routing/iroutingpolicy.h> #include <vespa/documentapi/common.h> @@ -26,19 +25,9 @@ public: * @param param A string of recipients to select unless recipients have been configured. */ ANDPolicy(const string& param); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~ANDPolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~ANDPolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; private: ANDPolicy(const ANDPolicy &); // hide diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h index 2f901ebad2d..bf17a77ca6a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h @@ -10,7 +10,7 @@ class ContentPolicy : public StoragePolicy public: ContentPolicy(const string& param); private: - virtual string createConfigId(const string & clusterName) const override; + string createConfigId(const string & clusterName) const override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h index 678210b1416..362185576ff 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "config-documentrouteselectorpolicy.h" #include <vespa/document/select/node.h> #include <map> #include <vespa/messagebus/routing/iroutingpolicy.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/documentapi/messagebus/policies/config-documentrouteselectorpolicy.h> #include <vespa/documentapi/common.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> @@ -64,14 +64,8 @@ public: * @return The error string, or null if no error. */ const string &getError() const; - - // Implements Subscriber. void configure(std::unique_ptr<messagebus::protocol::DocumentrouteselectorpolicyConfig> cfg) override; - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h index 790e0ab923c..fddccb1e3d9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h @@ -22,11 +22,7 @@ public: * @param msg The message of the error to assign. */ ErrorPolicy(const string &msg); - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h index d1e01cdbe59..9dd400f69c3 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h @@ -51,13 +51,7 @@ public: * @param param The address to use for this, if empty this will resolve to hostname. */ ExternPolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~ExternPolicy(); + ~ExternPolicy(); /** * This is a safety mechanism to allow the constructor to fail and signal that it can not be used. @@ -74,11 +68,7 @@ public: * @return The mirror pointer. */ slobrok::api::IMirrorAPI &getMirror() { return *_mirror; } - - // Overrides IRoutingPolicy. void select(mbus::RoutingContext &ctx) override; - - // Overrides IRoutingPolicy. void merge(mbus::RoutingContext &ctx) override; }; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h index 6a2a673807f..825c4a85d35 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.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/asyncinitializationpolicy.h> +#include "asyncinitializationpolicy.h" #include <vespa/config-slobroks.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/slobrok/imirrorapi.h> @@ -29,20 +29,15 @@ protected: public: ExternSlobrokPolicy(const std::map<string, string>& params); - virtual ~ExternSlobrokPolicy(); + ~ExternSlobrokPolicy(); /** * @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::IMirrorAPI* getMirror() const { return _mirror.get(); } - slobrok::api::IMirrorAPI::SpecList lookup(mbus::RoutingContext &context, const string& pattern); - - /** - * Initializes the policy - */ - virtual string init() override; + string init() override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h index 0541b784b1f..7b0e7e1f110 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h @@ -1,8 +1,8 @@ // 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/loadbalancer.h> -#include <vespa/documentapi/messagebus/policies/externslobrokpolicy.h> +#include "loadbalancer.h" +#include "externslobrokpolicy.h" namespace documentapi { @@ -10,8 +10,7 @@ class LoadBalancerPolicy : public ExternSlobrokPolicy { public: LoadBalancerPolicy(const string& param); - - virtual void doSelect(mbus::RoutingContext &context) override; + void doSelect(mbus::RoutingContext &context) override; /** Finds the TCP address of the target docproc. @@ -22,7 +21,7 @@ public: return _loadBalancer->getRecipient(lookup(context, _pattern)); } - virtual void merge(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; private: string _pattern; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h index af63403a8b1..d471e3051c8 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h @@ -74,19 +74,9 @@ public: * @param param The address to use for this, if empty this will resolve to hostname. */ LocalServicePolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~LocalServicePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~LocalServicePolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp index f55967b1c09..4d260a8e81f 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp @@ -18,6 +18,8 @@ MessageTypePolicy::MessageTypePolicy(const config::ConfigUri & configUri) : _fetcher.start(); } +MessageTypePolicy::~MessageTypePolicy() {} + void MessageTypePolicy::configure(std::unique_ptr<MessagetyperouteselectorpolicyConfig> cfg) { diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h index d29439db50c..d9a324a79c5 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h @@ -43,16 +43,10 @@ public: * @param configUri The configuration uri to subscribe with. */ MessageTypePolicy(const config::ConfigUri & configUri); - - // Implements Subscriber. + ~MessageTypePolicy(); void configure(std::unique_ptr<vespa::config::content::MessagetyperouteselectorpolicyConfig> cfg) override; - - // Implements IRoutingPolicy. void select(mbus::RoutingContext &context) override; - - // Implements IRoutingPolicy. void merge(mbus::RoutingContext &context) override; }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h index 3a3a22090f9..a14c2afdbc7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h @@ -61,19 +61,9 @@ public: * in slobrok. */ RoundRobinPolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~RoundRobinPolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~RoundRobinPolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h index ef6478e368a..c73c4c8560d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h @@ -39,13 +39,9 @@ private: public: StoragePolicy(const string& param); - virtual ~StoragePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void doSelect(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~StoragePolicy(); + void doSelect(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; void updateStateFromReply(WrongDistributionReply& reply); @@ -56,7 +52,6 @@ public: const storage::lib::ClusterState* getSystemState() const { return _state.get(); } virtual void configure(std::unique_ptr<storage::lib::Distribution::DistributionConfig> config); - string init() override; private: diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h index 49724785361..4d6dadb7156 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h @@ -65,20 +65,9 @@ public: * @param param The number of services to include in the set. */ SubsetServicePolicy(const string ¶m); - - /** - * Destructor. - * - * Frees all allocated resources. - */ - virtual ~SubsetServicePolicy(); - - // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context) override; - - // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context) override; + ~SubsetServicePolicy(); + void select(mbus::RoutingContext &context) override; + void merge(mbus::RoutingContext &context) override; }; } - diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h index aed43b8b2e5..c715792f263 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h @@ -99,11 +99,7 @@ public: */ typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -143,10 +139,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -180,8 +173,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - BatchDocumentUpdateMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + BatchDocumentUpdateMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class BatchDocumentUpdateReplyFactory : public DocumentReplyFactory { protected: @@ -194,8 +186,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class CreateVisitorReplyFactory : public DocumentReplyFactory { protected: @@ -285,8 +276,7 @@ public: DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentReply &msg, vespalib::GrowableByteBuffer &buf) const override; public: - GetDocumentReplyFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + GetDocumentReplyFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class MapVisitorMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; @@ -294,8 +284,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - MapVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + MapVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class MapVisitorReplyFactory : public DocumentReplyFactory { protected: @@ -308,8 +297,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - MultiOperationMessageFactory(const document::DocumentTypeRepo::SP &r) - : _repo(r) {} + MultiOperationMessageFactory(const document::DocumentTypeRepo::SP &r) : _repo(r) {} }; class MultiOperationReplyFactory : public DocumentReplyFactory { protected: @@ -326,8 +314,7 @@ public: bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(PutDocumentMessage & msg, document::ByteBuffer & buf) const; - PutDocumentMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + PutDocumentMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class PutDocumentReplyFactory : public DocumentReplyFactory { protected: @@ -354,8 +341,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - RemoveLocationMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + RemoveLocationMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class RemoveLocationReplyFactory : public DocumentReplyFactory { protected: @@ -402,8 +388,7 @@ public: bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(UpdateDocumentMessage & msg, document::ByteBuffer & buf) const; - UpdateDocumentMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + UpdateDocumentMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class UpdateDocumentReplyFactory : public DocumentReplyFactory { protected: diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h index bfa25c21d84..429c86e5049 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h @@ -58,10 +58,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -101,10 +98,7 @@ public: typedef std::unique_ptr<IRoutableFactory> UP; typedef std::shared_ptr<IRoutableFactory> SP; - // Implements IRoutableFactory. bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; - - // Implements IRoutableFactory. mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; @@ -145,8 +139,7 @@ public: DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: - CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) - : _repo(r) {} + CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class GetDocumentMessageFactory : public DocumentMessageFactory { diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h index 906fc508bd7..a41ae155170 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h @@ -36,9 +36,7 @@ public: const document::DocumentTypeRepo &_repo; string _configId; public: - DocumentRouteSelectorPolicyFactory( - const document::DocumentTypeRepo &repo, - const string &configId); + DocumentRouteSelectorPolicyFactory(const document::DocumentTypeRepo &repo, const string &configId); mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class ExternPolicyFactory : public IRoutingPolicyFactory { @@ -68,4 +66,3 @@ public: }; } - diff --git a/eval/src/tests/eval/function/function_test.cpp b/eval/src/tests/eval/function/function_test.cpp index 773b3e17d2e..964c48b670b 100644 --- a/eval/src/tests/eval/function/function_test.cpp +++ b/eval/src/tests/eval/function/function_test.cpp @@ -374,7 +374,7 @@ TEST("require that Call children can be accessed") { struct MyNodeHandler : public NodeHandler { std::vector<nodes::Node_UP> nodes; - virtual void handle(nodes::Node_UP node) override { + void handle(nodes::Node_UP node) override { if (node.get() != nullptr) { nodes.push_back(std::move(node)); } @@ -657,9 +657,9 @@ struct MySymbolExtractor : SymbolExtractor { } MySymbolExtractor() : extra(), invoke_count() {} explicit MySymbolExtractor(std::initializer_list<char> extra_in) : extra(extra_in), invoke_count() {} - virtual void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) - const override + + void extract_symbol(const char *pos_in, const char *end_in, + const char *&pos_out, vespalib::string &symbol_out) const override { ++invoke_count; for (; pos_in < end_in; ++pos_in) { diff --git a/fastlib/src/vespa/fastlib/io/fileinputstream.h b/fastlib/src/vespa/fastlib/io/fileinputstream.h index 08806f1d19d..045fc61500f 100644 --- a/fastlib/src/vespa/fastlib/io/fileinputstream.h +++ b/fastlib/src/vespa/fastlib/io/fileinputstream.h @@ -1,39 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** -******************************************************************************* -* -* @author Stein Hardy Danielsen -* @date Creation date: 2000-10-07 -* @version $Id$ -* -* @file -* -* FileInputStream class -* -* Copyright (c) : 1997-2000 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ -#pragma once - -#include <vespa/fastlib/io/inputstream.h> - +#pragma once +#include "inputstream.h" +#include <vespa/fastos/file.h> -/** -******************************************************************************** -* -* FileInputStream class -* @author Stein Hardy Danielsen -* @date Creation date: 2000-10-07 -* @version $Id$ -* -* -* Copyright (c) : 1997-2000 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ class Fast_FileInputStream : public Fast_InputStream { private: @@ -48,21 +19,16 @@ private: /** File opened ok flag */ bool _fileOpenedOk; - public: - - /** Constructor */ Fast_FileInputStream(const char *fileName); - - /** Destructor */ - virtual ~Fast_FileInputStream(void); + ~Fast_FileInputStream(); // Implementation of Fast_InputStream interface - virtual ssize_t Read(void *targetBuffer, size_t bufferSize); - virtual bool Close(); - virtual ssize_t Available(); - virtual ssize_t Skip(size_t); + ssize_t Read(void *targetBuffer, size_t bufferSize) override; + bool Close() override; + ssize_t Available() override; + ssize_t Skip(size_t) override; }; diff --git a/fastlib/src/vespa/fastlib/io/inputstream.h b/fastlib/src/vespa/fastlib/io/inputstream.h index 22f65eb95c3..d7b443d28ee 100644 --- a/fastlib/src/vespa/fastlib/io/inputstream.h +++ b/fastlib/src/vespa/fastlib/io/inputstream.h @@ -6,11 +6,10 @@ class Fast_InputStream { public: - virtual ~Fast_InputStream() { } - virtual ssize_t Available(void) = 0; - virtual bool Close(void) = 0; + virtual ssize_t Available() = 0; + virtual bool Close() = 0; virtual ssize_t Read(void *targetBuffer, size_t bufferSize) = 0; virtual ssize_t Skip(size_t skipNBytes) = 0; }; diff --git a/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp b/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp index 6c355b78aa1..5c8f8d4d8f2 100644 --- a/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp +++ b/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp @@ -1,17 +1,13 @@ // 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/fastos/app.h> #include <vespa/fastlib/net/httpheaderparser.h> #include <vespa/fastlib/io/fileinputstream.h> #include <vespa/fastlib/io/bufferedinputstream.h> - - - class HeaderReaderApp : public FastOS_Application { public: - - int Main(void) override + int Main() override { if (_argc != 2) { diff --git a/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h b/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h index 36477f6b010..082ab62a75e 100644 --- a/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h +++ b/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h @@ -4,7 +4,7 @@ #include <vespa/fastlib/testsuite/test.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/util/stringfmt.h> -#include "../latintokenizer.h" +#include <vespa/fastlib/text/latintokenizer.h> class Mapel_Pucntuation { private: @@ -142,10 +142,9 @@ private: void TestTypeparamObservers(); public: - LatinTokenizerTest(); - virtual ~LatinTokenizerTest(); - - virtual void Run() override; + LatinTokenizerTest(); + ~LatinTokenizerTest(); + void Run() override; }; @@ -459,7 +458,7 @@ void LatinTokenizerTest::Run() class LatinTokenizerTestApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.cpp b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.cpp index b3bb709def9..98860410eef 100644 --- a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.cpp +++ b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.cpp @@ -1,5 +1,4 @@ // 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 "unicodeutiltest.h" int UnicodeUtilTestApp::Main() diff --git a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h index 28f1323384f..a18728c51a9 100644 --- a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h +++ b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.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. #include <vespa/fastlib/testsuite/test.h> - -#include "../unicodeutil.h" +#include <vespa/fastlib/text/unicodeutil.h> +#include <vespa/fastos/app.h> class UnicodeUtilTest : public Test { @@ -40,15 +40,15 @@ class UnicodeUtilTest : public Test } public: - virtual void Run() override { - // do the tests - _test(GetUTF8Char_WrongInput()); - _test(IsTerminalPunctuationChar()); - } + void Run() override { + // do the tests + _test(GetUTF8Char_WrongInput()); + _test(IsTerminalPunctuationChar()); + } }; class UnicodeUtilTestApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h b/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h index 3c18be1d552..c4eb6867dbd 100644 --- a/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h +++ b/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <memory> #include <vespa/fastlib/testsuite/test.h> - -#include "../wordfolder.h" -#include "../normwordfolder.h" +#include <vespa/fastlib/text/normwordfolder.h> class WordFoldersTest : public Test { @@ -115,17 +112,18 @@ class WordFoldersTest : public Test public: - virtual void Run() override { - // do the tests - _test(NormalizeWordFolderConstruction()); - _test(TokenizeAnnotatedBuffer()); - _test(TokenizeAnnotatedUCS4Buffer()); - _test(AccentRemovalTest()); - } + + void Run() override { + // do the tests + _test(NormalizeWordFolderConstruction()); + _test(TokenizeAnnotatedBuffer()); + _test(TokenizeAnnotatedUCS4Buffer()); + _test(AccentRemovalTest()); + } }; class WordFoldersTestApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/util/tests/bagtest.h b/fastlib/src/vespa/fastlib/util/tests/bagtest.h index 7ca33f318f0..597317bf38e 100644 --- a/fastlib/src/vespa/fastlib/util/tests/bagtest.h +++ b/fastlib/src/vespa/fastlib/util/tests/bagtest.h @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iostream> - #include <vespa/fastlib/util/bag.h> - #include <vespa/fastlib/testsuite/test.h> +#include <iostream> /** @@ -527,37 +525,30 @@ public: delete[] _array; } - - - virtual void Run() override { - RunTest(&BagTester::IterPtrInitTest); - RunTest(&BagTester::IterRefInitTest); - RunTest(&BagTester::IterPtrStartTest); - RunTest(&BagTester::IterRefStartTest); - RunTest(&BagTester::IterStartOverTest); - RunTest(&BagTester::IterPPOperTest); - RunTest(&BagTester::GrowTest); - RunTest(&BagTester::AssignTest); - RunTest(&BagTester::CopyConstTest); - RunTest(&BagTester::EqualTest); - RunTest(&BagTester::DeleteEnumTest); - RunTest(&BagTester::RemoveTest); - RunTest(&BagTester::HasElementTest); - RunTest(&BagTester::RemoveAllElementsTest); - RunTest(&BagTester::GetBlocksizeTest); - RunTest(&BagTester::SetBlocksizeTest); - RunTest(&BagTester::NumberOfElementsTest); - } - - + void Run() override { + RunTest(&BagTester::IterPtrInitTest); + RunTest(&BagTester::IterRefInitTest); + RunTest(&BagTester::IterPtrStartTest); + RunTest(&BagTester::IterRefStartTest); + RunTest(&BagTester::IterStartOverTest); + RunTest(&BagTester::IterPPOperTest); + RunTest(&BagTester::GrowTest); + RunTest(&BagTester::AssignTest); + RunTest(&BagTester::CopyConstTest); + RunTest(&BagTester::EqualTest); + RunTest(&BagTester::DeleteEnumTest); + RunTest(&BagTester::RemoveTest); + RunTest(&BagTester::HasElementTest); + RunTest(&BagTester::RemoveAllElementsTest); + RunTest(&BagTester::GetBlocksizeTest); + RunTest(&BagTester::SetBlocksizeTest); + RunTest(&BagTester::NumberOfElementsTest); + } }; class BagTest : public FastOS_Application { public: - - virtual int Main() override; + int Main() override; }; - - diff --git a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp index 970f87831b1..92cc2fee719 100644 --- a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp +++ b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp @@ -1,14 +1,12 @@ // 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 <stdio.h> -#include <assert.h> -#include <memory> +#include <vespa/fastos/app.h> +#include <vespa/fastos/file.h> #include <vespa/vespalib/stllike/string.h> -#include "../base64.h" +#include <vespa/fastlib/util/base64.h> class Base64Test : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/filedistribution/src/tests/filedownloader/testfiledownloader.cpp b/filedistribution/src/tests/filedownloader/testfiledownloader.cpp index 56a664ea7e1..9bf96abc1eb 100644 --- a/filedistribution/src/tests/filedownloader/testfiledownloader.cpp +++ b/filedistribution/src/tests/filedownloader/testfiledownloader.cpp @@ -2,7 +2,6 @@ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN -#include <vespa/fastos/fastos.h> #include <vespa/filedistribution/distributor/filedownloader.h> #include <vespa/filedistribution/distributor/filedistributortrackerimpl.h> @@ -12,12 +11,7 @@ #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> -#include <libtorrent/session.hpp> -#include <libtorrent/tracker_manager.hpp> -#include <libtorrent/torrent.hpp> - #include <vespa/filedistribution/manager/createtorrent.h> -#include <vespa/filedistribution/model/filedistributionmodel.h> #include <vespa/filedistribution/common/componentsdeleter.h> namespace fs = boost::filesystem; @@ -47,16 +41,16 @@ createDownloader(ComponentsDeleter& deleter, } //anonymous namespace class MockFileDistributionModel : public FileDistributionModel { - virtual FileDBModel& getFileDBModel() override { + FileDBModel& getFileDBModel() override { abort(); } - virtual std::set<std::string> getFilesToDownload() override { + std::set<std::string> getFilesToDownload() override { return std::set<std::string>(); } - virtual PeerEntries getPeers(const std::string&, size_t) override { - PeerEntries peers(2); + PeerEntries getPeers(const std::string& , size_t) override { + PeerEntries peers(2); peers[0].ip = localHost; peers[0].port = uploaderPort; @@ -66,9 +60,9 @@ class MockFileDistributionModel : public FileDistributionModel { return peers; } - virtual void addPeer(const std::string&) override {} - virtual void removePeer(const std::string&) override {} - virtual void peerFinished(const std::string&) override {} + void addPeer(const std::string&) override {} + void removePeer(const std::string&) override {} + void peerFinished(const std::string&) override {} }; diff --git a/filedistribution/src/tests/rpc/mockfileprovider.h b/filedistribution/src/tests/rpc/mockfileprovider.h index 33177d939c1..fd66acfb0fc 100644 --- a/filedistribution/src/tests/rpc/mockfileprovider.h +++ b/filedistribution/src/tests/rpc/mockfileprovider.h @@ -32,7 +32,6 @@ public: downloadCompleted()(fileReference, "downloaded/path/" + fileReference); } - //Overrides DownloadCompletedSignal& downloadCompleted() override { return _downloadCompleted; } diff --git a/filedistribution/src/tests/scheduler/test-scheduler.cpp b/filedistribution/src/tests/scheduler/test-scheduler.cpp index 5be60569449..1ce5cbb9bc2 100644 --- a/filedistribution/src/tests/scheduler/test-scheduler.cpp +++ b/filedistribution/src/tests/scheduler/test-scheduler.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. #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN -#include <vespa/fastos/fastos.h> + #include <boost/test/unit_test.hpp> #include <vespa/filedistribution/distributor/scheduler.h> @@ -9,7 +9,6 @@ #include <iostream> #include <boost/thread/barrier.hpp> -#include <thread> using filedistribution::Scheduler; using namespace std::literals; diff --git a/filedistribution/src/tests/zkfacade/test-zkfacade.cpp b/filedistribution/src/tests/zkfacade/test-zkfacade.cpp index 46db660d452..51a3f0b40e3 100644 --- a/filedistribution/src/tests/zkfacade/test-zkfacade.cpp +++ b/filedistribution/src/tests/zkfacade/test-zkfacade.cpp @@ -2,14 +2,10 @@ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #define BOOST_TEST_MODULE zkfacade test -#include <vespa/fastos/fastos.h> -#include <boost/test/unit_test.hpp> +#include <boost/test/unit_test.hpp> #include <iostream> - #include <boost/thread/barrier.hpp> -#include <boost/checked_delete.hpp> - #include <vespa/filedistribution/common/componentsdeleter.h> #include <vespa/filedistribution/model/zkfacade.h> diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp index 1db2f7c6e49..9906074afc5 100644 --- a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp +++ b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp @@ -1,13 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "filedistributortrackerimpl.h" -#include <cmath> -#include <libtorrent/tracker_manager.hpp> -#include <libtorrent/torrent.hpp> -#include <vespa/filedistribution/model/filedistributionmodel.h> -#include <vespa/filedistribution/model/zkfacade.h> #include "filedownloader.h" -#include "hostname.h" +#include <vespa/filedistribution/model/zkfacade.h> #include <vespa/log/log.h> LOG_SETUP(".filedistributiontrackerimpl"); diff --git a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp index 0288f3082f8..3b4d043a30b 100644 --- a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp +++ b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp @@ -1,22 +1,15 @@ // 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 "filedistributionmodel.h" - -#include <vector> -#include <set> -#include <string> -#include <cstdlib> +#include "filedistributionmodel.h" +#include "zkfiledbmodel.h" +#include "deployedfilestodownload.h" +#include "filedistributionmodelimpl.h" #include <boost/filesystem.hpp> #include <zookeeper/zookeeper.h> #include <vespa/log/log.h> LOG_SETUP(".filedistributionmodel"); -#include "zkfiledbmodel.h" -#include "deployedfilestodownload.h" -#include "filedistributionmodelimpl.h" - namespace fs = boost::filesystem; using filedistribution::ZKFileDBModel; diff --git a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h index e132ec8b230..4b2b14ea21f 100644 --- a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h +++ b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h @@ -2,7 +2,7 @@ #pragma once #include "filedistributionmodel.h" -#include <vespa/filedistribution/model/config-filereferences.h> +#include "config-filereferences.h" #include "zkfacade.h" #include "zkfiledbmodel.h" #include <vespa/config/config.h> diff --git a/fnet/src/examples/frt/rpc/echo_client.cpp b/fnet/src/examples/frt/rpc/echo_client.cpp index b5fabb32363..9a5cf7cbd64 100644 --- a/fnet/src/examples/frt/rpc/echo_client.cpp +++ b/fnet/src/examples/frt/rpc/echo_client.cpp @@ -1,13 +1,12 @@ // 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("echo_client"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class EchoClient : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp index 3dd936f7fea..2bf740f7b1e 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("rpc_callback_client"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> struct RPC : public FRT_Invokable { @@ -34,7 +32,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp index 419b1266d23..67eac0743d6 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("rpc_callback_server"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> struct RPC : public FRT_Invokable { @@ -40,7 +38,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_client.cpp b/fnet/src/examples/frt/rpc/rpc_client.cpp index f5e5a9fe1e2..435bfb6f08c 100644 --- a/fnet/src/examples/frt/rpc/rpc_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_client.cpp @@ -1,14 +1,12 @@ // 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("rpc_client"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCClient : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_info.cpp b/fnet/src/examples/frt/rpc/rpc_info.cpp index 5b7aebd6bdd..ae9eafa210d 100644 --- a/fnet/src/examples/frt/rpc/rpc_info.cpp +++ b/fnet/src/examples/frt/rpc/rpc_info.cpp @@ -1,8 +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/log/log.h> -LOG_SETUP("rpc_info"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCInfo : public FastOS_Application { @@ -64,7 +63,7 @@ public: printf("\n"); } - virtual int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/frt/rpc/rpc_invoke.cpp b/fnet/src/examples/frt/rpc/rpc_invoke.cpp index 0f64ef9b539..1bb572a6025 100644 --- a/fnet/src/examples/frt/rpc/rpc_invoke.cpp +++ b/fnet/src/examples/frt/rpc/rpc_invoke.cpp @@ -1,8 +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/log/log.h> -LOG_SETUP("rpc_invoke"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCClient : public FastOS_Application { @@ -43,7 +42,7 @@ private: int run(); public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_proxy.cpp b/fnet/src/examples/frt/rpc/rpc_proxy.cpp index 6c805d6a173..e73f556b9d8 100644 --- a/fnet/src/examples/frt/rpc/rpc_proxy.cpp +++ b/fnet/src/examples/frt/rpc/rpc_proxy.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("rpc_proxy"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> //----------------------------------------------------------------------------- struct Session @@ -68,7 +66,7 @@ private: public: ReqDone(RPCProxy &proxy) : _proxy(proxy) {} - virtual void RequestDone(FRT_RPCRequest *req) override; + void RequestDone(FRT_RPCRequest *req) override; }; void @@ -209,7 +207,7 @@ RPCProxy::HOOK_Fini(FRT_RPCRequest *req) class App : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_server.cpp b/fnet/src/examples/frt/rpc/rpc_server.cpp index 823d3c893b1..2b7e16b91b6 100644 --- a/fnet/src/examples/frt/rpc/rpc_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_server.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("rpc_server"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCServer : public FRT_Invokable { @@ -107,7 +105,7 @@ private: public: App() : _server() {} - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/ping/packets.h b/fnet/src/examples/ping/packets.h index 68cc27ccb5b..27a06bdaab3 100644 --- a/fnet/src/examples/ping/packets.h +++ b/fnet/src/examples/ping/packets.h @@ -1,36 +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 <vespa/fnet/packet.h> +#include <vespa/fnet/ipacketfactory.h> enum { PCODE_PING_REQUEST = 1, PCODE_PING_REPLY = 2 }; - class PingRequest : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; - class PingReply : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; class PingPacketFactory : public FNET_IPacketFactory { public: - virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; + FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; }; diff --git a/fnet/src/examples/ping/pingclient.cpp b/fnet/src/examples/ping/pingclient.cpp index fb834b9108b..0b28f118685 100644 --- a/fnet/src/examples/ping/pingclient.cpp +++ b/fnet/src/examples/ping/pingclient.cpp @@ -1,15 +1,13 @@ // 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("pingclient"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingClient : public FastOS_Application { public: - int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/ping/pingserver.cpp b/fnet/src/examples/ping/pingserver.cpp index 173e627ac23..3c76bc951ec 100644 --- a/fnet/src/examples/ping/pingserver.cpp +++ b/fnet/src/examples/ping/pingserver.cpp @@ -1,10 +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/log/log.h> -LOG_SETUP("pingserver"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingServer : public FNET_IServerAdapter, public FNET_IPacketHandler, @@ -12,15 +10,13 @@ class PingServer : public FNET_IServerAdapter, { public: bool InitAdminChannel(FNET_Channel *) override { return false; } - bool InitChannel(FNET_Channel *channel, uint32_t) override - { + bool InitChannel(FNET_Channel *channel, uint32_t) override { channel->SetContext(FNET_Context(channel)); channel->SetHandler(this); return true; } - - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override - { + + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override { if (packet->GetPCODE() == PCODE_PING_REQUEST) { fprintf(stderr, "Got ping request, sending ping reply\n"); context._value.CHANNEL->Send(new PingReply()); @@ -28,8 +24,8 @@ public: packet->Free(); return FNET_FREE_CHANNEL; } - - int Main() override; + + int Main() override; }; diff --git a/fnet/src/examples/proxy/proxy.cpp b/fnet/src/examples/proxy/proxy.cpp index 40d7a44c7f6..2d1d44174a4 100644 --- a/fnet/src/examples/proxy/proxy.cpp +++ b/fnet/src/examples/proxy/proxy.cpp @@ -1,9 +1,10 @@ // 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("proxy"); + #include <vespa/fnet/fnet.h> +#include <vespa/fastos/app.h> +#include <vespa/log/log.h> +LOG_SETUP("proxy"); class RawPacket : public FNET_Packet { @@ -12,10 +13,10 @@ private: public: RawPacket() : _data() {} - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; uint32_t @@ -69,7 +70,7 @@ public: _server = server; } - virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; }; @@ -139,14 +140,14 @@ private: public: Proxy() : _transport() {} - virtual bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override; - virtual FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override; - virtual void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; + bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override; + FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override; + void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; // --------------------------------------------- - virtual bool InitAdminChannel(FNET_Channel *channel) override; - virtual bool InitChannel(FNET_Channel *, uint32_t) override; + bool InitAdminChannel(FNET_Channel *channel) override; + bool InitChannel(FNET_Channel *, uint32_t) override; // --------------------------------------------- - virtual int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/timeout/timeout.cpp b/fnet/src/examples/timeout/timeout.cpp index 8a52d769282..7edfbe4fb1c 100644 --- a/fnet/src/examples/timeout/timeout.cpp +++ b/fnet/src/examples/timeout/timeout.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("timeout"); -#include <vespa/fnet/fnet.h> +#include <vespa/fnet/fnet.h> +#include <vespa/fastos/app.h> class Timeout : public FNET_Task { @@ -20,7 +18,7 @@ public: _queue(queue) {} - virtual void PerformTask() override; + void PerformTask() override; }; diff --git a/fnet/src/tests/frt/method_pt/method_pt.cpp b/fnet/src/tests/frt/method_pt/method_pt.cpp index 4b869f6ba9f..98ab9d228a1 100644 --- a/fnet/src/tests/frt/method_pt/method_pt.cpp +++ b/fnet/src/tests/frt/method_pt/method_pt.cpp @@ -112,9 +112,9 @@ class MediumHandler1 : public FRT_Invokable, public MediumB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -123,9 +123,9 @@ class MediumHandler2 : public MediumA, public MediumB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -134,9 +134,9 @@ class MediumHandler3 : public MediumA, public FRT_Invokable { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; //------------------------------------------------------------- @@ -146,9 +146,9 @@ class ComplexHandler1 : public FRT_Invokable, public ComplexB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -157,9 +157,9 @@ class ComplexHandler2 : public ComplexA, public ComplexB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -168,9 +168,9 @@ class ComplexHandler3 : public ComplexA, public FRT_Invokable { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; //------------------------------------------------------------- diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index 7853c473f5e..d51557e9cfd 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -48,8 +48,7 @@ struct LockedReqWait : public FRT_IRequestWait return ret; } - virtual void RequestDone(FRT_RPCRequest *) override - { + void RequestDone(FRT_RPCRequest *) override { _wasLocked = isLocked(); _cond.Lock(); _done = true; @@ -57,8 +56,7 @@ struct LockedReqWait : public FRT_IRequestWait _cond.Unlock(); } - void waitReq() - { + void waitReq() { _cond.Lock(); while(!_done) { _cond.Wait(); @@ -78,9 +76,7 @@ private: DelayedReturn &operator=(const DelayedReturn &); public: - DelayedReturn(FNET_Scheduler *sched, - FRT_RPCRequest *req, - double delay) + DelayedReturn(FNET_Scheduler *sched, FRT_RPCRequest *req, double delay) : FNET_Task(sched), _req(req) { diff --git a/fnet/src/tests/frt/rpc/sharedblob.cpp b/fnet/src/tests/frt/rpc/sharedblob.cpp index a086584b36a..363a7891cbd 100644 --- a/fnet/src/tests/frt/rpc/sharedblob.cpp +++ b/fnet/src/tests/frt/rpc/sharedblob.cpp @@ -10,10 +10,10 @@ struct MyBlob : FRT_ISharedBlob { int refcnt; MyBlob() : refcnt(1) {} - virtual uint32_t getLen() override { return (strlen("blob_test") + 1); } - virtual const char *getData() override { return "blob_test"; } - virtual void addRef() override { ++refcnt; } - virtual void subRef() override { --refcnt; } + uint32_t getLen() override { return (strlen("blob_test") + 1); } + const char *getData() override { return "blob_test"; } + void addRef() override { ++refcnt; } + void subRef() override { --refcnt; } }; struct Data diff --git a/fnet/src/tests/locking/castspeed.cpp b/fnet/src/tests/locking/castspeed.cpp index 1f57bc4757c..859ec08ec69 100644 --- a/fnet/src/tests/locking/castspeed.cpp +++ b/fnet/src/tests/locking/castspeed.cpp @@ -18,14 +18,14 @@ class C: public A { public: B *otherB; - virtual B* asB() override { return otherB; } + B* asB() override { return otherB; } C() : otherB(nullptr) {} }; class B: public C { public: - virtual B* asB() override { return this; } + B* asB() override { return this; } }; diff --git a/fnet/src/tests/locking/drainpackets.cpp b/fnet/src/tests/locking/drainpackets.cpp index fb86371c9ec..b453793843f 100644 --- a/fnet/src/tests/locking/drainpackets.cpp +++ b/fnet/src/tests/locking/drainpackets.cpp @@ -2,15 +2,13 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/fnet/fnet.h> - class MyPacket : public FNET_Packet { public: - uint32_t GetPCODE() override { return 0; } + uint32_t GetPCODE() override { return 0; } uint32_t GetLength() override { return 0; } void Encode(FNET_DataBuffer *) override {} - bool Decode(FNET_DataBuffer *, uint32_t) override - { return true; } + bool Decode(FNET_DataBuffer *, uint32_t) override { return true; } }; diff --git a/fnet/src/tests/scheduling/sloweventloop.cpp b/fnet/src/tests/scheduling/sloweventloop.cpp index a4b57cfd218..a13205f4b0e 100644 --- a/fnet/src/tests/scheduling/sloweventloop.cpp +++ b/fnet/src/tests/scheduling/sloweventloop.cpp @@ -2,7 +2,6 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/fnet/fnet.h> - class MyTask : public FNET_Task { public: diff --git a/fnet/src/tests/sync_execute/sync_execute.cpp b/fnet/src/tests/sync_execute/sync_execute.cpp index c832ef0330d..ca77ab6f73b 100644 --- a/fnet/src/tests/sync_execute/sync_execute.cpp +++ b/fnet/src/tests/sync_execute/sync_execute.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/vespalib/testkit/test_kit.h> -#include <vespa/fnet/fnet.h> -#include <vespa/vespalib/util/sync.h> +#include <vespa/fnet/transport.h> +#include <vespa/fnet/iexecutable.h> struct DoIt : public FNET_IExecutable { vespalib::Gate gate; - virtual void execute() override { + void execute() override { gate.countDown(); } }; diff --git a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp index 75defdc3881..19ebdb253a3 100644 --- a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp +++ b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("simpleserver"); -#include <vespa/fastos/fastos.h> -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class Server : public FRT_Invokable { diff --git a/jrt_test/src/tests/echo/echo-client.cpp b/jrt_test/src/tests/echo/echo-client.cpp index 2d72cdc937b..14faac3ca9e 100644 --- a/jrt_test/src/tests/echo/echo-client.cpp +++ b/jrt_test/src/tests/echo/echo-client.cpp @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("echo_client"); -#include <vespa/fastos/fastos.h> + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class EchoClient : public FastOS_Application { diff --git a/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp b/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp index 98584e9a284..9857ea073c2 100644 --- a/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp +++ b/jrt_test/src/tests/mandatory-methods/extract-reflection.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 <vespa/fastos/app.h> #include <vespa/fnet/frt/frt.h> class RPCInfo : public FastOS_Application diff --git a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp index 46a1e2bc11a..41624eaf108 100644 --- a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp +++ b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("mockup_server"); -#include <vespa/fastos/fastos.h> -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class MockupServer : public FRT_Invokable { diff --git a/jrt_test/src/tests/rpc-error/test-errors.cpp b/jrt_test/src/tests/rpc-error/test-errors.cpp index 07ff7425f9a..184e733da82 100644 --- a/jrt_test/src/tests/rpc-error/test-errors.cpp +++ b/jrt_test/src/tests/rpc-error/test-errors.cpp @@ -2,7 +2,6 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/fnet/frt/frt.h> - class TestErrors : public vespalib::TestApp { private: diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index f73e4c8fc3a..4a648e6af19 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -1,29 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Implementation of the test suite application SrcTestSuite. - * - * @file SrcTestSuite.cpp - * - * @author Knut Omang - * - * @date Created 21 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/fastlib/testsuite/suite.h> + #include "testenv.h" #include "mcandTest.h" #include "queryparserTest.h" #include "matchobjectTest.h" #include "auxTest.h" - +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/fastlib/testsuite/suite.h> /** * The SrcTestSuite class runs all the unit tests for the src module. * @@ -53,7 +36,7 @@ SrcTestSuite::SrcTestSuite() : */ class SrcTestSuiteApp : public vespalib::TestApp { public: - virtual int Main() override; + int Main() override; }; int SrcTestSuiteApp::Main() { diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp index 2dc3457e6c3..349792ed723 100644 --- a/juniper/src/test/auxTest.cpp +++ b/juniper/src/test/auxTest.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP(""); #include "auxTest.h" +#include <vespa/fastos/file.h> +#include <vespa/log/log.h> +LOG_SETUP(".auxtest"); // Using separator definitions only from here: @@ -560,7 +560,7 @@ void AuxTest::test_summary(Matcher& m, const char* content, size_t content_len, class DefProps : public IJuniperProperties { public: - virtual const char* GetProperty(const char*, const char* def) override { + const char* GetProperty(const char*, const char* def) override { return def; } }; @@ -626,12 +626,12 @@ public: TokenChecker(Token* output) : _out(output), i(0) { } - virtual void handle_token(Token& token) override { + void handle_token(Token& token) override { _out[i] = token; i++; } - virtual void handle_end(Token&) override {} + void handle_end(Token&) override {} }; @@ -670,13 +670,13 @@ private: std::vector<std::string> _tokens; public: TokenProcessor(const std::string & text) : _text(text), _tokens() {} - virtual void handle_token(Token & t) override { + void handle_token(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_token(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), //(int)t.bytepos, (int)t.wordpos, t.bytelen, t.curlen); } - virtual void handle_end(Token & t) override { + void handle_end(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_end(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), diff --git a/juniper/src/test/auxTest.h b/juniper/src/test/auxTest.h index 218dcaab6d0..a98adc732f4 100644 --- a/juniper/src/test/auxTest.h +++ b/juniper/src/test/auxTest.h @@ -7,7 +7,6 @@ #include <vespa/fastlib/testsuite/test.h> #include "testenv.h" - class AuxTest : public Test { private: @@ -25,14 +24,14 @@ public: void Run(MethodContainer::iterator &itr); void Run(const char* method); void Run(int argc, char* argv[]); - virtual void Run() override; + void Run() override; protected: /** * Since we are running within Emacs, the default behavior of * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } private: // tests: void TestPropertyMap(); diff --git a/juniper/src/test/auxTestApp.cpp b/juniper/src/test/auxTestApp.cpp index 3f43c706d35..a9475998aa4 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -1,12 +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/vespalib/testkit/testapp.h> #include "auxTest.h" +#include <vespa/vespalib/testkit/testapp.h> class AuxTestApp : public vespalib::TestApp { public: - virtual int Main() override; + int Main() override; }; diff --git a/juniper/src/test/fakerewriter.h b/juniper/src/test/fakerewriter.h index 0a0554f76fc..cf78fd28255 100644 --- a/juniper/src/test/fakerewriter.h +++ b/juniper/src/test/fakerewriter.h @@ -8,10 +8,10 @@ class FakeRewriter: public juniper::IRewriter { public: FakeRewriter() : _name() {} - virtual const char* Name() const override; - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term) override; - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length) override; - virtual const char* NextTerm(juniper::RewriteHandle* exp, size_t& length) override; + const char* Name() const override; + juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term) override; + juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length) override; + const char* NextTerm(juniper::RewriteHandle* exp, size_t& length) override; private: std::string _name; }; diff --git a/juniper/src/test/matchobjectTest.h b/juniper/src/test/matchobjectTest.h index 9e0828cfa77..0f4a1ace55b 100644 --- a/juniper/src/test/matchobjectTest.h +++ b/juniper/src/test/matchobjectTest.h @@ -17,9 +17,9 @@ ***************************************************************************/ #pragma once -#include <map> -#include <vespa/fastlib/testsuite/test.h> #include "testenv.h" +#include <vespa/fastlib/testsuite/test.h> +#include <map> /** * The MatchObjectTest class holds @@ -98,8 +98,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } - + void print_progress() override { *m_osptr << '.' << std::flush; } public: MatchObjectTest() : Test("MatchObject"), test_methods_() { init(); } @@ -109,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index 065af199589..f755c3e932a 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -1,25 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the MatchObject class in isolation. - * - * @file matchobjectTestApp.cpp - * - * @author Knut Omang - * - * @date Created 21 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "matchobjectTest.h" #include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The MatchObjectTestApp class is the main routine for running the unit @@ -29,7 +12,7 @@ */ class MatchObjectTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchObjectTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/mcandTest.cpp b/juniper/src/test/mcandTest.cpp index b185707c1be..7f7d7d42100 100644 --- a/juniper/src/test/mcandTest.cpp +++ b/juniper/src/test/mcandTest.cpp @@ -16,11 +16,11 @@ * ALL RIGHTS RESERVED * </pre> ***************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(""); + #include "mcandTest.h" -#include "testenv.h" + +#include <vespa/log/log.h> +LOG_SETUP(".mcandtest"); // Comment out cerr below to ignore unimplemented tests #define NOTEST(name) \ @@ -405,13 +405,13 @@ struct MyTokenProcessor : public ITokenProcessor Matcher &_m; std::vector<size_t> _cands; MyTokenProcessor(Matcher &m) : _m(m), _cands() {} - virtual void handle_token(Token &token) override { + void handle_token(Token &token) override { _m.handle_token(token); const match_sequence *ms = _m.GetWorkSet(); _cands.push_back(ms[0].size()); LOG(info, "match_sequence[0].size(%zu)", _cands.back()); } - virtual void handle_end(Token &token) override { + void handle_end(Token &token) override { _m.handle_end(token); } }; diff --git a/juniper/src/test/mcandTest.h b/juniper/src/test/mcandTest.h index 754c18ee9dd..3fc32ee9f5d 100644 --- a/juniper/src/test/mcandTest.h +++ b/juniper/src/test/mcandTest.h @@ -196,7 +196,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -207,7 +207,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/mcandTestApp.cpp b/juniper/src/test/mcandTestApp.cpp index 8a93c14cfc9..cb33e503bb5 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -1,25 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the MatchCandidate class in isolation. - * - * @file mcandTestApp.cpp - * - * @author Knut Omang - * - * @date Created 27 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "mcandTest.h" -#include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The MatchCandidateTestApp class is the main routine for running the unit @@ -29,7 +11,7 @@ */ class MatchCandidateTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchCandidateTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/queryparserTest.h b/juniper/src/test/queryparserTest.h index b4f464f7592..d868fca659e 100644 --- a/juniper/src/test/queryparserTest.h +++ b/juniper/src/test/queryparserTest.h @@ -17,11 +17,11 @@ ***************************************************************************/ #pragma once -#include <map> -#include <vespa/fastlib/testsuite/test.h> #include "testenv.h" #include <vespa/juniper/queryparser.h> #include <vespa/juniper/rewriter.h> +#include <vespa/fastlib/testsuite/test.h> +#include <map> /** * The QueryParserTest class holds @@ -97,7 +97,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() override { *m_osptr << '.' << std::flush; } + void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -108,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run() override; + void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/queryparserTestApp.cpp b/juniper/src/test/queryparserTestApp.cpp index 3559b0177b6..7b3151a2314 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -1,25 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Definition and implementation of the application for running unit tests - * for the QueryParser class in isolation. - * - * @file queryparserTestApp.cpp - * - * @author Knut Omang - * - * @date Created 24 Feb 2003 - * - * $Id$ - * - * <pre> - * Copyright (c) : 2003 Fast Search & Transfer ASA - * ALL RIGHTS RESERVED - * </pre> - ****************************************************************************/ -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/testkit/testapp.h> + #include "queryparserTest.h" #include "testenv.h" +#include <vespa/vespalib/testkit/testapp.h> /** * The QueryParserTestApp class is the main routine for running the unit @@ -29,7 +12,7 @@ */ class QueryParserTestApp : public vespalib::TestApp { public: - virtual int Main() override { + int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); QueryParserTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/testenv.h b/juniper/src/test/testenv.h index 88d250767fc..cc126f3f3a5 100644 --- a/juniper/src/test/testenv.h +++ b/juniper/src/test/testenv.h @@ -20,6 +20,7 @@ #include <vespa/juniper/mcand.h> #include <vespa/juniper/propreader.h> #include <vespa/juniper/specialtokenregistry.h> +#include <vespa/fastos/app.h> namespace juniper { @@ -55,9 +56,9 @@ private: std::map<std::string, std::string> _map; public: PropertyMap(); - virtual ~PropertyMap(); + ~PropertyMap(); PropertyMap &set(const char *name, const char *value); - virtual const char* GetProperty(const char* name, const char* def = NULL) override; + const char* GetProperty(const char* name, const char* def = NULL) override; }; diff --git a/memfilepersistence/src/tests/device/devicemanagertest.cpp b/memfilepersistence/src/tests/device/devicemanagertest.cpp index 15882663383..f5e16032361 100644 --- a/memfilepersistence/src/tests/device/devicemanagertest.cpp +++ b/memfilepersistence/src/tests/device/devicemanagertest.cpp @@ -1,10 +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/memfilepersistence/device/devicemanager.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/util/exception.h> -#include <sys/errno.h> #include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> namespace storage { @@ -70,19 +68,17 @@ namespace { std::ostringstream ost; Listener() : ost() { ost << "\n"; } - virtual ~Listener() {} + ~Listener() {} - virtual void handleDirectoryEvent(Directory& dir, const IOEvent& e) override { + void handleDirectoryEvent(Directory& dir, const IOEvent& e) override { ost << "Dir " << dir.getPath() << ": " << e.toString(true) << "\n"; } - virtual void handlePartitionEvent(Partition& part, const IOEvent& e) override { - ost << "Partition " << part.getMountPoint() << ": " - << e.toString(true) << "\n"; + void handlePartitionEvent(Partition& part, const IOEvent& e) override { + ost << "Partition " << part.getMountPoint() << ": " << e.toString(true) << "\n"; } - virtual void handleDiskEvent(Disk& disk, const IOEvent& e) override { + void handleDiskEvent(Disk& disk, const IOEvent& e) override { ost << "Disk " << disk.getId() << ": " << e.toString(true) << "\n"; } - }; } diff --git a/memfilepersistence/src/tests/device/partitionmonitortest.cpp b/memfilepersistence/src/tests/device/partitionmonitortest.cpp index 44f3752d840..d1f40e07320 100644 --- a/memfilepersistence/src/tests/device/partitionmonitortest.cpp +++ b/memfilepersistence/src/tests/device/partitionmonitortest.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 <vespa/memfilepersistence/device/partitionmonitor.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vdstestlib/cppunit/macros.h> @@ -56,7 +55,7 @@ struct FakeStatter : public PartitionMonitor::Statter { _info.f_bfree -= (size / _info.f_bsize); } - virtual void statFileSystem(const std::string&, struct statvfs& info) override { + void statFileSystem(const std::string&, struct statvfs& info) override { info = _info; } }; diff --git a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp index 673a72068b7..4372a8a45a7 100644 --- a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp +++ b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp @@ -1,14 +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 <set> -#include <vector> -#include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> #include <tests/spi/memfiletestutils.h> #include <tests/spi/simulatedfailurefile.h> #include <tests/spi/options_builder.h> -#include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/select/parser.h> namespace storage { diff --git a/memfilepersistence/src/tests/spi/memcachetest.cpp b/memfilepersistence/src/tests/spi/memcachetest.cpp index 07697b79cac..7eece580b0a 100644 --- a/memfilepersistence/src/tests/spi/memcachetest.cpp +++ b/memfilepersistence/src/tests/spi/memcachetest.cpp @@ -1,10 +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/memfilepersistence/memfile/memfilecache.h> #include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h> #include <tests/spi/memfiletestutils.h> -#include <vespa/vdstestlib/cppunit/macros.h> namespace storage { diff --git a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp index eefe962979d..265054a02ba 100644 --- a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp +++ b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp @@ -1,13 +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/memfilepersistence/mapper/memfilemapper.h> #include <vespa/memfilepersistence/mapper/memfile_v1_serializer.h> #include <vespa/memfilepersistence/mapper/memfile_v1_verifier.h> -#include <vespa/memfilepersistence/mapper/fileinfo.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> #include <tests/spi/memfiletestutils.h> -#include <vespa/vdstestlib/cppunit/macros.h> namespace storage { namespace memfile { diff --git a/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp b/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp index ad20a28ed0c..f612bec1189 100644 --- a/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp +++ b/memfilepersistence/src/tests/spi/memfilev1serializertest.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/memfilepersistence/mapper/memfilemapper.h> #include <vespa/memfilepersistence/mapper/memfile_v1_serializer.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> #include <tests/spi/memfiletestutils.h> -#include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/memfilepersistence/mapper/locationreadplanner.h> #include <tests/spi/simulatedfailurefile.h> #include <tests/spi/options_builder.h> @@ -229,23 +226,16 @@ struct DummyMemFileIOInterface : MemFileIOInterface { void clear(DocumentPart) override {} bool verifyConsistent() const override { return true; } void move(const FileSpecification&) override {} - DataLocation copyCache(const MemFileIOInterface&, - DocumentPart, - DataLocation) override - { + DataLocation copyCache(const MemFileIOInterface&, DocumentPart, DataLocation) override { return DataLocation(); } - void close() override {} + void close() override {}; bool isCached(DataLocation, DocumentPart) const override { return false; } bool isPersisted(DataLocation, DocumentPart) const override { return false; } - uint32_t getSerializedSize(DocumentPart, - DataLocation) const override { return 0; } + uint32_t getSerializedSize(DocumentPart, DataLocation) const override { return 0; } - void ensureCached(Environment&, - DocumentPart, - const std::vector<DataLocation>&) override - {} + void ensureCached(Environment&, DocumentPart, const std::vector<DataLocation>&) override {} size_t getCachedSize(DocumentPart) const override { return 0; } }; diff --git a/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp b/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp index 51951e22aea..632bded6c6c 100644 --- a/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp +++ b/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp @@ -1,14 +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/memfilepersistence/mapper/memfilemapper.h> #include <vespa/memfilepersistence/mapper/memfile_v1_serializer.h> #include <vespa/memfilepersistence/mapper/memfile_v1_verifier.h> -#include <vespa/memfilepersistence/mapper/fileinfo.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> #include <tests/spi/memfiletestutils.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <tests/spi/simulatedfailurefile.h> namespace storage { namespace memfile { diff --git a/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp b/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp index ffe7972552f..cb1bc057705 100644 --- a/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp +++ b/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> -#include <vespa/vdstestlib/cppunit/macros.h> #include <tests/spi/memfiletestutils.h> #include <tests/spi/options_builder.h> @@ -51,19 +50,15 @@ class SimpleMemFileIOBufferTest : public SingleDiskMemFileTestUtils public: class DummyFileReader : public VersionSerializer { public: - virtual FileVersion getFileVersion() override { return FileVersion(); } - virtual void loadFile(MemFile&, Environment&, Buffer&, uint64_t ) override {} - virtual FlushResult flushUpdatesToFile(MemFile&, Environment&) override { + FileVersion getFileVersion() override { return FileVersion(); } + void loadFile(MemFile&, Environment&, Buffer&, uint64_t ) override {} + FlushResult flushUpdatesToFile(MemFile&, Environment&) override { return FlushResult::TooSmall; } - virtual void rewriteFile(MemFile&, Environment&) override {} - virtual bool verify(MemFile&, Environment&, - std::ostream&, bool, uint16_t) override { return false; }; - virtual void cacheLocations(MemFileIOInterface&, - Environment&, - const Options&, - DocumentPart, - const std::vector<DataLocation>&) override {} + void rewriteFile(MemFile&, Environment&) override {} + bool verify(MemFile&, Environment&, std::ostream&, bool, uint16_t) override { return false; }; + void cacheLocations(MemFileIOInterface&, Environment&, const Options&, + DocumentPart, const std::vector<DataLocation>&) override {} }; DummyFileReader dfr; diff --git a/memfilepersistence/src/tests/testrunner.cpp b/memfilepersistence/src/tests/testrunner.cpp index 16027870c47..5baa0f60b6e 100644 --- a/memfilepersistence/src/tests/testrunner.cpp +++ b/memfilepersistence/src/tests/testrunner.cpp @@ -1,14 +1,12 @@ // 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 <iostream> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("persistencecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp b/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp index 0f36f0a0571..5de40311b2f 100644 --- a/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp +++ b/memfilepersistence/src/tests/tools/vdsdisktooltest.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 <vespa/config/subscription/configuri.h> #include <vespa/memfilepersistence/tools/vdsdisktool.h> #include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h index 23e4857fdb3..cc2145444a5 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h @@ -37,8 +37,7 @@ public: const String& getPath() const { return _path; } FileVersion getWantedFileVersion() const { return _wantedVersion; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const FileSpecification& o) const { return (_bucketId == o._bucketId && _dir == o._dir @@ -48,4 +47,3 @@ public: } // storage } // memfile - diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp index b483d4691c4..b0fa6cf6667 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp @@ -26,8 +26,7 @@ namespace { } struct RealStatter : public PartitionMonitor::Statter { - virtual void statFileSystem(const std::string& file, struct statvfs& info) override - { + void statFileSystem(const std::string& file, struct statvfs& info) override { if (statvfs(file.c_str(), &info) != 0) { vespalib::asciistream ost; ost << "Failed to run statvfs to find data on disk containing " diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp index 742a37fcf36..d9cc0c35cc4 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp @@ -3,16 +3,13 @@ #include "memfile_v1_serializer.h" #include "memfile_v1_verifier.h" -#include "memfilemapper.h" #include "locationreadplanner.h" #include "uniqueslotgenerator.h" -#include "simplememfileiobuffer.h" #include <vespa/memfilepersistence/common/exceptions.h> #include <vespa/memfilepersistence/spi/memfilepersistenceprovidermetrics.h> -#include <vespa/vespalib/util/crc.h> #include <vespa/vespalib/stllike/asciistream.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP(".persistence.memfilev1"); namespace storage { @@ -742,19 +739,16 @@ namespace { _buffer.resize(firstAligned - _headerBlockIndex); } - virtual uint32_t getCachedAmount() const override - { return _buffer.size() + _headerBlockIndex; } - - virtual char* getCache(uint32_t pos) override { + uint32_t getCachedAmount() const override { return _buffer.size() + _headerBlockIndex; } + char* getCache(uint32_t pos) override { // We should never get requests to write prior to header block // index. assert(pos >= _headerBlockIndex); return (&_buffer[0] + (pos - _headerBlockIndex)); } - virtual bool duplicateCacheWrite() const override { return true; } - - virtual void setData(const char* data, size_t len, uint64_t pos) override { + bool duplicateCacheWrite() const override { return true; } + void setData(const char* data, size_t len, uint64_t pos) override { if (pos < _headerBlockIndex) { if (len <= _headerBlockIndex - pos) return; uint32_t diff = (_headerBlockIndex - pos); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h index 283ab174895..500c47e94e4 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h @@ -1,10 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/memfilepersistence/mapper/bufferedfilewriter.h> -#include <vespa/memfilepersistence/mapper/versionserializer.h> -#include <vespa/memfilepersistence/mapper/fileinfo.h> -#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> +#include "bufferedfilewriter.h" +#include "versionserializer.h" +#include "fileinfo.h" +#include "simplememfileiobuffer.h" #include <vespa/memfilepersistence/common/environment.h> #include <vespa/memfilepersistence/spi/threadmetricprovider.h> @@ -22,40 +22,25 @@ public: MemFileV1Serializer(ThreadMetricProvider&); - virtual FileVersion getFileVersion() override { return TRADITIONAL_SLOTFILE; } + FileVersion getFileVersion() override { return TRADITIONAL_SLOTFILE; } + void loadFile(MemFile& file, Environment&, Buffer& buffer, uint64_t bytesRead) override; - virtual void loadFile(MemFile& file, Environment&, - Buffer& buffer, uint64_t bytesRead) override; - - void cacheLocationsForPart(SimpleMemFileIOBuffer& cache, - DocumentPart part, - uint32_t blockIndex, + void cacheLocationsForPart(SimpleMemFileIOBuffer& cache, DocumentPart part, uint32_t blockIndex, const std::vector<DataLocation>& locationsToCache, const std::vector<DataLocation>& locationsRead, SimpleMemFileIOBuffer::BufferAllocation& buf); - virtual void cacheLocations(MemFileIOInterface& cache, - Environment& env, - const Options& options, - DocumentPart part, - const std::vector<DataLocation>& locations) override; - - virtual FlushResult flushUpdatesToFile(MemFile&, Environment&) override; - - virtual void rewriteFile(MemFile&, Environment&) override; + void cacheLocations(MemFileIOInterface& cache, Environment& env, const Options& options, + DocumentPart part, const std::vector<DataLocation>& locations) override; - virtual bool verify(MemFile&, Environment&, - std::ostream& errorReport, bool repairErrors, - uint16_t fileVerifyFlags) override; - - uint64_t read(vespalib::LazyFile& file, - char* buf, - const std::vector<DataLocation>& readOps); + FlushResult flushUpdatesToFile(MemFile&, Environment&) override; + void rewriteFile(MemFile&, Environment&) override; + bool verify(MemFile&, Environment&, std::ostream& errorReport, + bool repairErrors, uint16_t fileVerifyFlags) override; + uint64_t read(vespalib::LazyFile& file, char* buf, const std::vector<DataLocation>& readOps); void ensureFormatSpecificDataSet(const MemFile& file); - - uint32_t writeMetaData(BufferedFileWriter& writer, - const MemFile& file); + uint32_t writeMetaData(BufferedFileWriter& writer, const MemFile& file); uint32_t writeAndUpdateLocations( MemFile& file, @@ -68,4 +53,3 @@ public: } // memfile } // storage - diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h index 6ed529e6c80..74875d3ee79 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h @@ -199,8 +199,7 @@ public: class PartNotCachedException : public vespalib::Exception { public: - PartNotCachedException(const std::string& msg, - const std::string& location) + PartNotCachedException(const std::string& msg, const std::string& location) : vespalib::Exception(msg, location) {}; }; @@ -211,64 +210,39 @@ public: const FileSpecification& fileSpec, const Environment& env); - virtual Document::UP getDocumentHeader( - const document::DocumentTypeRepo& repo, - DataLocation loc) const override; - - virtual document::DocumentId getDocumentId(DataLocation loc) const override; - - virtual void readBody( - const document::DocumentTypeRepo& repo, - DataLocation loc, - Document& doc) const override; - - virtual DataLocation addDocumentIdOnlyHeader( - const DocumentId& id, - const document::DocumentTypeRepo& repo) override; - - virtual DataLocation addHeader(const Document& doc) override; - - virtual DataLocation addBody(const Document& doc) override; - - virtual void clear(DocumentPart type) override; - - virtual bool verifyConsistent() const override; + Document::UP getDocumentHeader(const document::DocumentTypeRepo& repo, DataLocation loc) const override; + document::DocumentId getDocumentId(DataLocation loc) const override; + void readBody(const document::DocumentTypeRepo& repo, DataLocation loc, Document& doc) const override; + DataLocation addDocumentIdOnlyHeader(const DocumentId& id, const document::DocumentTypeRepo& repo) override; + DataLocation addHeader(const Document& doc) override; + DataLocation addBody(const Document& doc) override; + void clear(DocumentPart type) override; + bool verifyConsistent() const override; /** * Moves the underlying file to another location. */ - virtual void move(const FileSpecification& target) override; - - virtual void close() override; - - virtual DataLocation copyCache(const MemFileIOInterface& source, - DocumentPart part, - DataLocation loc) override; + void move(const FileSpecification& target) override; + void close() override; + DataLocation copyCache(const MemFileIOInterface& source, DocumentPart part, DataLocation loc) override; /** * Add a location -> buffer mapping */ - void cacheLocation(DocumentPart part, - DataLocation loc, - BufferType::SP buf, - uint32_t bufferPos); + void cacheLocation(DocumentPart part, DataLocation loc, BufferType::SP buf, uint32_t bufferPos); /** * @return Returns true if the given location is cached. */ - virtual bool isCached(DataLocation loc, DocumentPart type) const override; + bool isCached(DataLocation loc, DocumentPart type) const override; /** * @return Returns true if the given location has been persisted to disk. */ - virtual bool isPersisted(DataLocation loc, DocumentPart type) const override; - virtual uint32_t getSerializedSize(DocumentPart part, - DataLocation loc) const override; - - virtual void ensureCached(Environment& env, - DocumentPart part, - const std::vector<DataLocation>& locations) override; + bool isPersisted(DataLocation loc, DocumentPart type) const override; + uint32_t getSerializedSize(DocumentPart part, DataLocation loc) const override; + void ensureCached(Environment& env, DocumentPart part, const std::vector<DataLocation>& locations) override; /** * Moves the given location into the persisted data area. @@ -342,14 +316,9 @@ private: // the reasoning about a given bucket in the face of such actions. std::shared_ptr<const Options> _options; - DataLocation addLocation(DocumentPart part, - BufferAllocation newData); - + DataLocation addLocation(DocumentPart part, BufferAllocation newData); const Data& getData(DocumentPart part, DataLocation loc) const; - - BufferAllocation serializeDocumentIdOnlyHeader( - const DocumentId& id, - const document::DocumentTypeRepo&); + BufferAllocation serializeDocumentIdOnlyHeader(const DocumentId& id, const document::DocumentTypeRepo&); BufferAllocation serializeHeader(const Document& doc); BufferAllocation serializeBody(const Document& doc); @@ -358,5 +327,3 @@ private: } } - - diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h index b3ac15ed376..f22035faf04 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h @@ -27,12 +27,12 @@ #pragma once +#include "memslot.h" +#include "slotiterator.h" +#include "memfileiointerface.h" #include <vespa/memfilepersistence/common/filespecification.h> #include <vespa/memfilepersistence/common/types.h> -#include <vespa/memfilepersistence/memfile/memslot.h> -#include <vespa/memfilepersistence/memfile/slotiterator.h> #include <vespa/vespalib/io/fileutil.h> -#include <vespa/memfilepersistence/memfile/memfileiointerface.h> namespace storage { namespace memfile { diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp index 8ea60d57f80..e8fff0facd0 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp @@ -1,19 +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 "memfilecache.h" #include <vespa/memfilepersistence/common/environment.h> #include <vespa/memfilepersistence/mapper/memfilemapper.h> -#include <vespa/memfilepersistence/memfile/memfilecache.h> -#include <vespa/log/log.h> -#include <vespa/vespalib/util/vstringfmt.h> #include <vespa/memfilepersistence/spi/memfilepersistenceprovidermetrics.h> +#include <vespa/log/log.h> LOG_SETUP(".persistence.memfile.cache"); namespace storage { namespace memfile { - void MemFileCache::Entry::setInUse(bool inUse) { LOG(debug, "Setting in use to %d for file %s", inUse, _file.toString().c_str()); @@ -111,7 +108,7 @@ struct MemFileCache::CacheEntryGuard : public MemFilePtr::EntryGuard { _entry(&entry) { } - virtual ~CacheEntryGuard() { + ~CacheEntryGuard() { if (_entry) { _cache.done(*_entry); } @@ -121,20 +118,20 @@ struct MemFileCache::CacheEntryGuard : public MemFilePtr::EntryGuard { return _entry->_file; } - virtual void deleteFile() override { + void deleteFile() override { LOG(debug, "Cache entry guard deleting %s", _file->toString().c_str()); _env._memFileMapper.deleteFile(*_file, _env); erase(); } - virtual void erase() override { + void erase() override { LOG(debug, "Cache entry guard erasing %s from cache", _file->toString().c_str()); _cache.erase(document::BucketId(_entry->_file.getFile().getBucketId())); _entry = 0; } - virtual void move(EntryGuard& target) override { + void move(EntryGuard& target) override { LOG(debug, "Cache entry guard moving %s", _file->toString().c_str()); _cache.move(*this, static_cast<CacheEntryGuard&>(target)); } @@ -175,10 +172,7 @@ MemFileCache::setCacheSize(MemoryUsage cacheSize) vespalib::LockGuard lock(_cacheLock); _cacheLimit = cacheSize; - - _memoryToken->resize(std::min(_memoryToken->getSize(), _cacheLimit.sum()), - _cacheLimit.sum()); - + _memoryToken->resize(std::min(_memoryToken->getSize(), _cacheLimit.sum()), _cacheLimit.sum()); evictWhileFull(); } diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h index b1d68591b92..91106cd765b 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h @@ -65,8 +65,8 @@ public: Timestamp fromTimestamp, Timestamp toTimestamp); - virtual void iterate() const override; - virtual SlotIterator* clone() const override; + void iterate() const override; + SlotIterator* clone() const override; }; class AllSlotsIterator : public SlotIterator { @@ -82,8 +82,8 @@ public: Timestamp fromTimestamp, Timestamp toTimestamp); - virtual void iterate() const override; - virtual SlotIterator* clone() const override; + void iterate() const override; + SlotIterator* clone() const override; }; /** @@ -127,4 +127,3 @@ public: } // memfile } // storage - diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp index 247722588f5..9e75e4fa182 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp @@ -1,9 +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/memfilepersistence/spi/splitoperationhandler.h> -#include <vespa/memfilepersistence/spi/cacheevictionguard.h> -#include <vespa/log/log.h> +#include "splitoperationhandler.h" +#include "cacheevictionguard.h" + +#include <vespa/log/log.h> LOG_SETUP(".persistence.memfile.handler.split"); namespace storage { @@ -25,7 +25,7 @@ struct BucketMatcher : public SlotMatcher { _factory(factory), _bid(bid) {} - virtual bool match(const Slot& slot) override { + bool match(const Slot& slot) override { document::DocumentId id(slot.getDocumentId()); document::BucketId bucket = _factory.getBucketId(id); bucket.setUsedBits(_bid.getUsedBits()); @@ -69,7 +69,7 @@ SplitOperationHandler::splitIntoFile(MemFile& source, MemFileCacheEvictionGuard targetFile(getMemFile(target, false)); LOG(debug, - "Found %" PRIu64 " slots to move from file %s to file %s", + "Found %zu slots to move from file %s to file %s", ts.size(), source.getFile().toString().c_str(), targetFile->getFile().toString().c_str()); diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp index c794d611767..072b3e9fae0 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.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 "dumpslotfile.h" #include <vespa/config/helper/configgetter.h> #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> @@ -9,7 +9,6 @@ #include <vespa/memfilepersistence/mapper/memfilemapper.h> #include <vespa/memfilepersistence/memfile/memfilecache.h> #include <vespa/memfilepersistence/spi/memfilepersistenceprovidermetrics.h> -#include <vespa/memfilepersistence/tools/dumpslotfile.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> #include <vespa/storageframework/defaultimplementation/component/componentregisterimpl.h> #include <vespa/storageframework/defaultimplementation/memory/nomemorymanager.h> diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp index f8d13714ae9..544be9c5eac 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.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 "dumpslotfile.h" #include <vespa/config/subscription/configuri.h> -#include <vespa/memfilepersistence/tools/dumpslotfile.h> +#include <vespa/fastos/app.h> #include <iostream> namespace { diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp index 7127c75cb1b..34855aeabc1 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp @@ -1,13 +1,10 @@ // 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 "vdsdisktool.h" #include <vespa/defaults.h> -#include <vespa/log/log.h> -#include <vespa/memfilepersistence/tools/vdsdisktool.h> +#include <vespa/fastos/app.h> #include <iostream> -LOG_SETUP(".vdsdisktool"); - namespace { struct DiskApp : public FastOS_Application { int Main() override { diff --git a/messagebus/src/tests/context/context.cpp b/messagebus/src/tests/context/context.cpp index 5ad36df7c72..3ba19e8f858 100644 --- a/messagebus/src/tests/context/context.cpp +++ b/messagebus/src/tests/context/context.cpp @@ -27,7 +27,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/loadbalance/loadbalance.cpp b/messagebus/src/tests/loadbalance/loadbalance.cpp index 83ff4c042da..9e2a6e48d24 100644 --- a/messagebus/src/tests/loadbalance/loadbalance.cpp +++ b/messagebus/src/tests/loadbalance/loadbalance.cpp @@ -28,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { ++cnt; session->acknowledge(std::move(msg)); } diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index e80505b2e89..df6ca38dd0d 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -46,8 +46,8 @@ public: _destinationSession(0), _messageCounter(0) {} - virtual void handleMessage(Message::UP msg) override - { + void handleMessage(Message::UP msg) override + { SimpleMessage& simpleMsg(dynamic_cast<SimpleMessage&>(*msg)); LOG(spam, "Attempting to acquire lock for %s", simpleMsg.getValue().c_str()); diff --git a/messagebus/src/tests/messenger/messenger.cpp b/messagebus/src/tests/messenger/messenger.cpp index 5cf3625523f..7b2b75212ee 100644 --- a/messagebus/src/tests/messenger/messenger.cpp +++ b/messagebus/src/tests/messenger/messenger.cpp @@ -1,7 +1,4 @@ // 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("messagebus_test"); #include <vespa/messagebus/messenger.h> #include <vespa/vespalib/util/barrier.h> diff --git a/messagebus/src/tests/oos/oos.cpp b/messagebus/src/tests/oos/oos.cpp index b19de4a94f8..dc224a1519c 100644 --- a/messagebus/src/tests/oos/oos.cpp +++ b/messagebus/src/tests/oos/oos.cpp @@ -1,7 +1,4 @@ // 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("oos_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/errorcode.h> @@ -31,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/protocolrepository/protocolrepository.cpp b/messagebus/src/tests/protocolrepository/protocolrepository.cpp index cf1d77bdc7e..f9c971336c5 100644 --- a/messagebus/src/tests/protocolrepository/protocolrepository.cpp +++ b/messagebus/src/tests/protocolrepository/protocolrepository.cpp @@ -1,7 +1,4 @@ // 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("protocolrepository_test"); #include <vespa/messagebus/protocolrepository.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/messagebus/src/tests/replygate/replygate.cpp b/messagebus/src/tests/replygate/replygate.cpp index d190f278be4..8f784495866 100644 --- a/messagebus/src/tests/replygate/replygate.cpp +++ b/messagebus/src/tests/replygate/replygate.cpp @@ -1,7 +1,4 @@ // 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("replygate_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/imessagehandler.h> @@ -44,7 +41,7 @@ struct MySender : public IMessageHandler { // giving a sync reply here is against the API contract, but it is // ok for testing. - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { Reply::UP reply(new MyReply()); msg->swapState(*reply); IReplyHandler &handler = reply->getCallStack().pop(*reply); diff --git a/messagebus/src/tests/resender/resender.cpp b/messagebus/src/tests/resender/resender.cpp index dad8ef73e68..701ce20737c 100644 --- a/messagebus/src/tests/resender/resender.cpp +++ b/messagebus/src/tests/resender/resender.cpp @@ -1,7 +1,4 @@ // 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("routing_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/result/result.cpp b/messagebus/src/tests/result/result.cpp index a404135d64c..963e44d1dda 100644 --- a/messagebus/src/tests/result/result.cpp +++ b/messagebus/src/tests/result/result.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("result_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/result.h> #include <vespa/messagebus/error.h> diff --git a/messagebus/src/tests/routablequeue/routablequeue.cpp b/messagebus/src/tests/routablequeue/routablequeue.cpp index a6bd66bd5df..3f014236440 100644 --- a/messagebus/src/tests/routablequeue/routablequeue.cpp +++ b/messagebus/src/tests/routablequeue/routablequeue.cpp @@ -1,7 +1,4 @@ // 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("routablequeue_test"); #include <vespa/messagebus/routablequeue.h> #include <vespa/messagebus/testlib/simplemessage.h> @@ -16,8 +13,8 @@ private: static uint32_t _cnt; public: TestMessage(uint32_t id) : SimpleMessage(""), _id(id) { ++_cnt; } - virtual ~TestMessage() { --_cnt; } - virtual uint32_t getType() const override { return _id; } + ~TestMessage() { --_cnt; } + uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestMessage::_cnt = 0; @@ -28,8 +25,8 @@ private: static uint32_t _cnt; public: TestReply(uint32_t id) : SimpleReply(""), _id(id) { ++_cnt; } - virtual ~TestReply() { --_cnt; } - virtual uint32_t getType() const override { return _id; } + ~TestReply() { --_cnt; } + uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestReply::_cnt = 0; diff --git a/messagebus/src/tests/routeparser/routeparser.cpp b/messagebus/src/tests/routeparser/routeparser.cpp index a00cea825ba..fc000fe571b 100644 --- a/messagebus/src/tests/routeparser/routeparser.cpp +++ b/messagebus/src/tests/routeparser/routeparser.cpp @@ -1,7 +1,4 @@ // 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("routeparser_test"); #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/routing/errordirective.h> @@ -16,6 +13,9 @@ LOG_SETUP("routeparser_test"); #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("routeparser_test"); + using namespace mbus; class Test : public vespalib::TestApp { diff --git a/messagebus/src/tests/routing/routing.cpp b/messagebus/src/tests/routing/routing.cpp index 506d003a8b7..8fd2c3951e4 100644 --- a/messagebus/src/tests/routing/routing.cpp +++ b/messagebus/src/tests/routing/routing.cpp @@ -1,5 +1,4 @@ // 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/messagebus.h> @@ -15,8 +14,8 @@ #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/component/vtag.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP("routing_test"); using namespace mbus; @@ -414,12 +413,9 @@ private: public: MyPolicy(const MyPolicyFactory &parent) : _parent(parent) - { - // empty - } + {} - virtual void - select(RoutingContext &ctx) override + void select(RoutingContext &ctx) override { if (!_parent._selectRoute.empty()) { ctx.addChild(Route::parse(_parent._selectRoute)); @@ -433,9 +429,8 @@ public: throw TestException(); } } - - virtual void - merge(RoutingContext &ctx) override + + void merge(RoutingContext &ctx) override { if (_parent._mergeError != ErrorCode::NONE) { Reply::UP reply(new EmptyReply()); diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp index 6ee62b4d697..281cf782a6b 100644 --- a/messagebus/src/tests/routingcontext/routingcontext.cpp +++ b/messagebus/src/tests/routingcontext/routingcontext.cpp @@ -1,7 +1,4 @@ // 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("routingcontext_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index bcac60d800a..5ab1e57f0d4 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -1,7 +1,4 @@ // 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("sendadapter_test"); #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/testlib/receptor.h> @@ -12,6 +9,9 @@ LOG_SETUP("sendadapter_test"); #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/log/log.h> +LOG_SETUP("sendadapter_test"); + using namespace mbus; //////////////////////////////////////////////////////////////////////////////// diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp index ec2d1374e9b..ea6261f0169 100644 --- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp +++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp @@ -1,10 +1,12 @@ // 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("serviceaddress_test"); #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/vstringfmt.h> +#include <vespa/messagebus/testlib/slobrok.h> +#include <vespa/messagebus/testlib/testserver.h> +#include <vespa/messagebus/testlib/receptor.h> +#include <vespa/messagebus/testlib/simplemessage.h> +#include <vespa/messagebus/testlib/simplereply.h> +#include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/sourcesession.h> #include <vespa/messagebus/intermediatesession.h> @@ -15,12 +17,7 @@ LOG_SETUP("serviceaddress_test"); #include <vespa/messagebus/routing/routingspec.h> #include <vespa/messagebus/network/rpcservice.h> #include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/messagebus/testlib/testserver.h> -#include <vespa/messagebus/testlib/receptor.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> +#include <vespa/vespalib/util/vstringfmt.h> using namespace mbus; diff --git a/messagebus/src/tests/servicepool/servicepool.cpp b/messagebus/src/tests/servicepool/servicepool.cpp index 8601cfa8fee..76c366930d9 100644 --- a/messagebus/src/tests/servicepool/servicepool.cpp +++ b/messagebus/src/tests/servicepool/servicepool.cpp @@ -1,7 +1,4 @@ // 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("servicepool_test"); #include <vespa/messagebus/network/rpcnetwork.h> #include <vespa/messagebus/testlib/slobrok.h> diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp index 5f5fe847f57..1f6944adb9e 100644 --- a/messagebus/src/tests/shutdown/shutdown.cpp +++ b/messagebus/src/tests/shutdown/shutdown.cpp @@ -1,7 +1,4 @@ // 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("shutdown_test"); #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/errorcode.h> diff --git a/messagebus/src/tests/sourcesession/sourcesession.cpp b/messagebus/src/tests/sourcesession/sourcesession.cpp index 24d99f5d44f..a7fde7f28e0 100644 --- a/messagebus/src/tests/sourcesession/sourcesession.cpp +++ b/messagebus/src/tests/sourcesession/sourcesession.cpp @@ -1,7 +1,4 @@ // 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("sourcesession_test"); #include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/error.h> @@ -34,7 +31,7 @@ struct DelayedHandler : public IMessageHandler ~DelayedHandler() { session.reset(); } - virtual void handleMessage(Message::UP msg) override { + void handleMessage(Message::UP msg) override { // this will block the transport thread in the server messagebus, // but that should be ok, as we only want to test the timing in the // client messagebus... diff --git a/messagebus/src/tests/targetpool/targetpool.cpp b/messagebus/src/tests/targetpool/targetpool.cpp index 30744e74202..dda44765ba6 100644 --- a/messagebus/src/tests/targetpool/targetpool.cpp +++ b/messagebus/src/tests/targetpool/targetpool.cpp @@ -1,11 +1,10 @@ // 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/network/rpctargetpool.h> #include <vespa/messagebus/testlib/slobrok.h> #include <vespa/messagebus/testlib/testserver.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> +#include <vespa/log/log.h> LOG_SETUP("targetpool_test"); using namespace mbus; diff --git a/messagebus/src/tests/throttling/throttling.cpp b/messagebus/src/tests/throttling/throttling.cpp index acc5b2ddc4d..a1065c44487 100644 --- a/messagebus/src/tests/throttling/throttling.cpp +++ b/messagebus/src/tests/throttling/throttling.cpp @@ -1,7 +1,4 @@ // 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("throttling_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/destinationsession.h> diff --git a/messagebus/src/tests/timeout/timeout.cpp b/messagebus/src/tests/timeout/timeout.cpp index d51ee34a08b..a14176cb1ef 100644 --- a/messagebus/src/tests/timeout/timeout.cpp +++ b/messagebus/src/tests/timeout/timeout.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("timeout_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/emptyreply.h> diff --git a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp index 5a9324257b5..effe461c5a8 100644 --- a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp +++ b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("simple-roundtrip_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/messagebus/emptyreply.h> #include <vespa/messagebus/messagebus.h> diff --git a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h index d552c3c48e9..ff49f15b416 100644 --- a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h @@ -164,13 +164,8 @@ public: */ uint32_t getMaxPendingCount() const { return (uint32_t)_windowSize; } - // Implements IThrottlePolicy. bool canSend(const Message &msg, uint32_t pendingCount) override; - - // Implements IThrottlePolicy. void processMessage(Message &msg) override; - - // Implements IThrottlePolicy. void processReply(Reply &reply) override; }; diff --git a/messagebus/src/vespa/messagebus/emptyreply.h b/messagebus/src/vespa/messagebus/emptyreply.h index f2d431c8ada..db8beb33b9b 100644 --- a/messagebus/src/vespa/messagebus/emptyreply.h +++ b/messagebus/src/vespa/messagebus/emptyreply.h @@ -26,24 +26,23 @@ public: * * @return "" */ - virtual const string & getProtocol() const override; + const string & getProtocol() const override; /** * This method returns the message type id reserved for empty replies: 0 * * @return 0 */ - virtual uint32_t getType() const override; + uint32_t getType() const override; /** * Encodes this reply into an empty blob. * * @return empty blob */ - virtual Blob encode() const; + Blob encode() const; uint8_t priority() const override { return 8; } }; } // namespace mbus - diff --git a/messagebus/src/vespa/messagebus/intermediatesession.h b/messagebus/src/vespa/messagebus/intermediatesession.h index 064b223707f..b4832d5069a 100644 --- a/messagebus/src/vespa/messagebus/intermediatesession.h +++ b/messagebus/src/vespa/messagebus/intermediatesession.h @@ -87,10 +87,7 @@ public: */ const string getConnectionSpec() const; - // Implements IMessageHandler. void handleMessage(Message::UP message) override; - - // Implements IReplyHandler. void handleReply(Reply::UP reply) override; }; diff --git a/messagebus/src/vespa/messagebus/message.h b/messagebus/src/vespa/messagebus/message.h index 6fc72af0055..cea0aaa91fb 100644 --- a/messagebus/src/vespa/messagebus/message.h +++ b/messagebus/src/vespa/messagebus/message.h @@ -35,10 +35,9 @@ public: * will log an error and generate an auto-reply to avoid having the sender * wait indefinetly for a reply. */ - virtual ~Message(); + ~Message(); - // Overrides Routable. - virtual void swapState(Routable &rhs) override; + void swapState(Routable &rhs) override; /** * Returns the timestamp for when this message was last seen by message @@ -139,7 +138,7 @@ public: * * @return false */ - virtual bool isReply() const override { return false; } + bool isReply() const override { return false; } /** * Returns whether or not this message contains a sequence identifier that diff --git a/messagebus/src/vespa/messagebus/messenger.h b/messagebus/src/vespa/messagebus/messenger.h index fe76513eef9..70207029e19 100644 --- a/messagebus/src/vespa/messagebus/messenger.h +++ b/messagebus/src/vespa/messagebus/messenger.h @@ -47,7 +47,6 @@ private: bool _closed; protected: - // Implements FastOS_Runnable. void Run(FastOS_ThreadInterface *thread, void *arg) override; public: diff --git a/messagebus/src/vespa/messagebus/reply.h b/messagebus/src/vespa/messagebus/reply.h index 8bc4f5921e0..f352d442931 100644 --- a/messagebus/src/vespa/messagebus/reply.h +++ b/messagebus/src/vespa/messagebus/reply.h @@ -39,17 +39,10 @@ public: * will log an error and generate an auto-reply to avoid having the sender * wait indefinetly for a reply. */ - virtual ~Reply(); + ~Reply(); - // Inherit doc from Routable. - virtual void swapState(Routable &rhs) override; - - /** - * Inherited from Routable. Classifies this object as 'a reply'. - * - * @return true - */ - virtual bool isReply() const override; + void swapState(Routable &rhs) override; + bool isReply() const override; /** * Add an Error to this Reply diff --git a/messagebus/src/vespa/messagebus/routablequeue.h b/messagebus/src/vespa/messagebus/routablequeue.h index ea2b14b64f6..acb99d7269a 100644 --- a/messagebus/src/vespa/messagebus/routablequeue.h +++ b/messagebus/src/vespa/messagebus/routablequeue.h @@ -76,14 +76,14 @@ public: * * @param msg the Message to handle **/ - virtual void handleMessage(Message::UP msg) override; + void handleMessage(Message::UP msg) override; /** * Handle a Reply by enqueuing it. * * @param reply the Reply to handle **/ - virtual void handleReply(Reply::UP reply) override; + void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sendproxy.h b/messagebus/src/vespa/messagebus/sendproxy.h index ca0c3f39661..e0212c4c222 100644 --- a/messagebus/src/vespa/messagebus/sendproxy.h +++ b/messagebus/src/vespa/messagebus/sendproxy.h @@ -34,13 +34,8 @@ public: */ SendProxy(MessageBus &mbus, INetwork &net, Resender *resender); - // Implements IDiscardHandler. void handleDiscard(Context ctx) override; - - // Implements IMessageHandler. void handleMessage(Message::UP msg) override; - - // Implements IReplyHandler. void handleReply(Reply::UP reply) override; }; diff --git a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h index b7cc6bdfe99..586451ea83a 100644 --- a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h @@ -70,13 +70,8 @@ public: */ uint64_t getPendingSize() const; - // Implements IThrottlePolicy. bool canSend(const Message &msg, uint32_t pendingCount) override; - - // Implements IThrottlePolicy. void processMessage(Message &msg) override; - - // Implements IThrottlePolicy. void processReply(Reply &reply) override; }; diff --git a/messagebus/src/vespa/messagebus/systemtimer.h b/messagebus/src/vespa/messagebus/systemtimer.h index 14156253067..4a83add0732 100644 --- a/messagebus/src/vespa/messagebus/systemtimer.h +++ b/messagebus/src/vespa/messagebus/systemtimer.h @@ -12,7 +12,6 @@ namespace mbus { */ class SystemTimer : public ITimer { public: - // Implements ITimer. uint64_t getMilliTime() const override; }; diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.h b/messagebus/src/vespa/messagebus/testlib/custompolicy.h index 953f4f3c92e..4fec4efe7c2 100644 --- a/messagebus/src/vespa/messagebus/testlib/custompolicy.h +++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/messagebus/routing/iroutingpolicy.h> #include "simpleprotocol.h" +#include <vespa/messagebus/routing/iroutingpolicy.h> namespace mbus { @@ -17,8 +17,8 @@ public: const std::vector<uint32_t> consumableErrors, const std::vector<Route> &routes); - virtual void select(RoutingContext &context) override; - virtual void merge(RoutingContext &context) override; + void select(RoutingContext &context) override; + void merge(RoutingContext &context) override; }; class CustomPolicyFactory : public SimpleProtocol::IPolicyFactory { @@ -37,4 +37,3 @@ public: }; } // namespace mbus - diff --git a/messagebus/src/vespa/messagebus/testlib/receptor.h b/messagebus/src/vespa/messagebus/testlib/receptor.h index c64e60eb6de..2e9a424b481 100644 --- a/messagebus/src/vespa/messagebus/testlib/receptor.h +++ b/messagebus/src/vespa/messagebus/testlib/receptor.h @@ -20,11 +20,10 @@ private: Receptor &operator=(const Receptor &); public: Receptor(); - virtual void handleMessage(Message::UP msg) override; - virtual void handleReply(Reply::UP reply) override; + void handleMessage(Message::UP msg) override; + void handleReply(Reply::UP reply) override; Message::UP getMessage(double maxWait = 120.0); Reply::UP getReply(double maxWait = 120.0); }; } // namespace mbus - diff --git a/messagebus/src/vespa/messagebus/testlib/simplemessage.h b/messagebus/src/vespa/messagebus/testlib/simplemessage.h index cb14c48dd9f..aeee34045ff 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplemessage.h +++ b/messagebus/src/vespa/messagebus/testlib/simplemessage.h @@ -8,9 +8,9 @@ namespace mbus { class SimpleMessage : public Message { private: - string _value; - bool _hasSeqId; - uint64_t _seqId; + string _value; + bool _hasSeqId; + uint64_t _seqId; public: SimpleMessage(const string &str); @@ -25,9 +25,7 @@ public: bool hasSequenceId() const override; uint64_t getSequenceId() const override; uint32_t getApproxSize() const override; - uint8_t priority() const override { return 8; } - string toString() const override { return _value; } }; diff --git a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h index 843b7675b96..0551d177898 100644 --- a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h +++ b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h @@ -2,9 +2,8 @@ #pragma once -#include <map> -#include <string> #include <vespa/messagebus/iprotocol.h> +#include <map> namespace mbus { @@ -49,10 +48,7 @@ public: */ SimpleProtocol(); - /** - * Frees up any allocated resources. - */ - virtual ~SimpleProtocol(); + ~SimpleProtocol(); /** * Registers a policy factory with this protocol under a given name. Whenever a policy is requested that @@ -72,19 +68,10 @@ public: */ static void simpleMerge(RoutingContext &ctx); - // Implements IProtocol. const string & getName() const override; - - // Implements IProtocol. - IRoutingPolicy::UP createPolicy(const string &name, - const string ¶m) const override; - - // Implements IProtocol. + IRoutingPolicy::UP createPolicy(const string &name, const string ¶m) const override; Blob encode(const vespalib::Version &version, const Routable &routable) const override; - - // Implements IProtocol. Routable::UP decode(const vespalib::Version &version, BlobRef data) const override; }; } // namespace mbus - diff --git a/messagebus/src/vespa/messagebus/testlib/simplereply.h b/messagebus/src/vespa/messagebus/testlib/simplereply.h index 8016a517453..3b9ac7fe21e 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplereply.h +++ b/messagebus/src/vespa/messagebus/testlib/simplereply.h @@ -2,9 +2,8 @@ #pragma once -#include <string> -#include <vespa/messagebus/reply.h> #include "simplemessage.h" +#include <vespa/messagebus/reply.h> namespace mbus { @@ -19,11 +18,10 @@ public: virtual ~SimpleReply(); void setValue(const string &value); const string &getValue() const; - virtual const string & getProtocol() const override; - virtual uint32_t getType() const override; + const string & getProtocol() const override; + uint32_t getType() const override; uint8_t priority() const override { return 8; } }; } // namespace mbus - diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp index b3f02b1ad58..fa71cb9f9ad 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp @@ -20,7 +20,8 @@ public: guard.wait(); } } - virtual void PerformTask() override { + + void PerformTask() override { vespalib::MonitorGuard guard(_mon); _done = true; guard.signal(); diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.h b/messagebus/src/vespa/messagebus/testlib/slobrok.h index 2f8d4180ba5..1677f6635f7 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.h +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.h @@ -2,7 +2,6 @@ #pragma once -#include <memory> #include <vespa/messagebus/common.h> #include <vespa/slobrok/cfg.h> diff --git a/messagebus_test/src/tests/error/cpp-client.cpp b/messagebus_test/src/tests/error/cpp-client.cpp index 19cb09b3738..10d7eb7e521 100644 --- a/messagebus_test/src/tests/error/cpp-client.cpp +++ b/messagebus_test/src/tests/error/cpp-client.cpp @@ -1,19 +1,15 @@ // 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("cpp-client"); + #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/sourcesession.h> +#include <vespa/messagebus/errorcode.h> #include <vespa/messagebus/testlib/simplemessage.h> #include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/errorcode.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> #include <vespa/messagebus/sourcesessionparams.h> #include <vespa/messagebus/testlib/receptor.h> -#include <vespa/vespalib/util/sync.h> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/messagebus_test/src/tests/error/cpp-server.cpp b/messagebus_test/src/tests/error/cpp-server.cpp index 13cfa76984b..c738c871e9a 100644 --- a/messagebus_test/src/tests/error/cpp-server.cpp +++ b/messagebus_test/src/tests/error/cpp-server.cpp @@ -1,18 +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("cpp-server"); + #include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> #include <vespa/messagebus/emptyreply.h> -#include <vespa/messagebus/error.h> #include <vespa/messagebus/errorcode.h> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp index a381efc2238..81a764d02d9 100644 --- a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp +++ b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("dumpcodes"); + #include <vespa/messagebus/errorcode.h> -#include <string> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/messagebus_test/src/tests/speed/cpp-client.cpp b/messagebus_test/src/tests/speed/cpp-client.cpp index 54ccadc9ddd..dd3def7efc9 100644 --- a/messagebus_test/src/tests/speed/cpp-client.cpp +++ b/messagebus_test/src/tests/speed/cpp-client.cpp @@ -1,16 +1,12 @@ // 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("cpp-client"); + #include <vespa/messagebus/messagebus.h> #include <vespa/messagebus/routing/retrytransienterrorspolicy.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/sourcesession.h> -#include <vespa/messagebus/sourcesessionparams.h> #include <vespa/messagebus/testlib/simplemessage.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/vespalib/util/sync.h> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/messagebus_test/src/tests/speed/cpp-server.cpp b/messagebus_test/src/tests/speed/cpp-server.cpp index 904bf4d6d51..3d29f5641a2 100644 --- a/messagebus_test/src/tests/speed/cpp-server.cpp +++ b/messagebus_test/src/tests/speed/cpp-server.cpp @@ -1,15 +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("cpp-server"); + #include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> #include <vespa/messagebus/testlib/simplemessage.h> #include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/messagebus_test/src/tests/trace/cpp-server.cpp b/messagebus_test/src/tests/trace/cpp-server.cpp index ce495090e91..62ef2f82bad 100644 --- a/messagebus_test/src/tests/trace/cpp-server.cpp +++ b/messagebus_test/src/tests/trace/cpp-server.cpp @@ -1,16 +1,10 @@ // 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("cpp-server"); + #include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> #include <vespa/messagebus/testlib/simpleprotocol.h> #include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> #include <vespa/messagebus/emptyreply.h> +#include <vespa/fastos/app.h> using namespace mbus; diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 362cad83a66..0ba6bdfbd2f 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -9,8 +9,6 @@ #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/data/slime/slime.h> -#include <fstream> -#include <sstream> #include <vespa/log/log.h> LOG_SETUP(".test.metricmanager"); @@ -143,22 +141,20 @@ struct MetricNameVisitor : public MetricVisitor { MetricNameVisitor(bool debug_ = false) : debug(debug_) {} - virtual bool visitMetricSet(const MetricSet& metricSet, - bool autoGenerated) override - { + bool visitMetricSet(const MetricSet& metricSet, bool autoGenerated) override { if (debug) { ost << "<" << (autoGenerated ? "*" : "") << metricSet.getPath() << ">\n"; } return true; } - virtual void doneVisitingMetricSet(const MetricSet& metricSet) override { + void doneVisitingMetricSet(const MetricSet& metricSet) override { if (debug) { ost << "</" << metricSet.getPath() << ">\n"; } } - virtual bool visitMetric(const Metric& m, bool autoGenerated) override { + bool visitMetric(const Metric& m, bool autoGenerated) override { ost << (autoGenerated ? "*" : "") << m.getPath() << "\n"; return true; } @@ -390,7 +386,7 @@ namespace { struct FakeTimer : public MetricManager::Timer { time_t _time; FakeTimer(time_t startTime = 0) : _time(startTime) {} - virtual time_t getTime() const override { return _time; } + time_t getTime() const override { return _time; } }; struct BriefValuePrinter : public MetricVisitor { @@ -399,7 +395,7 @@ namespace { BriefValuePrinter() : count(0), ost() {} - virtual bool visitMetric(const Metric& metric, bool) override { + bool visitMetric(const Metric& metric, bool) override { if (++count > 1) ost << ","; //ost << metric.getPath() << ":"; ost << metric.getDoubleValue("value"); diff --git a/metrics/src/tests/metricsettest.cpp b/metrics/src/tests/metricsettest.cpp index 176572acbd4..2b45bd049e0 100644 --- a/metrics/src/tests/metricsettest.cpp +++ b/metrics/src/tests/metricsettest.cpp @@ -1,5 +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 <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/objects/floatingpointtype.h> #include <vespa/metrics/metrics.h> @@ -28,7 +28,7 @@ namespace { TestMetricVisitor(uint32_t setsToVisit_ = 100) : ost(), setsToVisit(setsToVisit_) {} - virtual bool visitMetricSet(const MetricSet& set, bool autoGenerated) override { + bool visitMetricSet(const MetricSet& set, bool autoGenerated) override { ost << "[" << (autoGenerated ? "*" : "") << set.getName() << "]\n"; if (setsToVisit > 0) { --setsToVisit; @@ -36,7 +36,7 @@ namespace { } return false; } - virtual bool visitMetric(const Metric& m, bool autoGenerated) override { + bool visitMetric(const Metric& m, bool autoGenerated) override { ost << (autoGenerated ? "*" : "") << m.getName() << "\n"; return true; } diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp index bee3e910fb3..5c13a0f82b6 100644 --- a/metrics/src/tests/snapshottest.cpp +++ b/metrics/src/tests/snapshottest.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 <vespa/metrics/metrics.h> #include <vespa/metrics/loadmetric.hpp> #include <vespa/metrics/summetric.hpp> @@ -40,8 +39,8 @@ struct SubSubMetricSet : public MetricSet { SubSubMetricSet(vespalib::stringref name, const LoadTypeSet& loadTypes_, MetricSet* owner = 0); ~SubSubMetricSet(); - virtual MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType copyType, - metrics::MetricSet* owner, bool includeUnused) const override; + MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType copyType, + metrics::MetricSet* owner, bool includeUnused) const override; void incValues(); }; @@ -191,10 +190,8 @@ TestMetricSet::incValues() { struct FakeTimer : public MetricManager::Timer { uint32_t _timeInSecs; - FakeTimer() : _timeInSecs(1) {} - - virtual time_t getTime() const override { return _timeInSecs; } + time_t getTime() const override { return _timeInSecs; } }; } // End of anonymous namespace diff --git a/metrics/src/tests/stresstest.cpp b/metrics/src/tests/stresstest.cpp index 5a2a736e9ba..70194ecd861 100644 --- a/metrics/src/tests/stresstest.cpp +++ b/metrics/src/tests/stresstest.cpp @@ -1,5 +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 <vespa/metrics/metrics.h> #include <vespa/metrics/loadmetric.hpp> #include <vespa/metrics/summetric.hpp> @@ -108,7 +108,7 @@ OuterMetricSet::~OuterMetricSet() { } //std::cerr << "Loadgiver thread joined\n"; } - virtual void run() override { + void run() override { uint64_t i = 0; while (running()) { ++i; diff --git a/metrics/src/tests/testrunner.cpp b/metrics/src/tests/testrunner.cpp index 5d8dc8d4c1f..9bf86e3276a 100644 --- a/metrics/src/tests/testrunner.cpp +++ b/metrics/src/tests/testrunner.cpp @@ -1,14 +1,12 @@ // 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 <iostream> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storagecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/persistence/src/tests/dummyimpl/dummyimpltest.cpp b/persistence/src/tests/dummyimpl/dummyimpltest.cpp index 4b107fde324..9348d90c05a 100644 --- a/persistence/src/tests/dummyimpl/dummyimpltest.cpp +++ b/persistence/src/tests/dummyimpl/dummyimpltest.cpp @@ -1,13 +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/log/log.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/persistence/conformancetest/conformancetest.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> -LOG_SETUP(".test.dummyimpl"); - namespace storage { namespace spi { @@ -20,9 +16,7 @@ struct DummyImplTest : public ConformanceTest { return PersistenceProvider::UP(new dummy::DummyPersistence(repo, 4)); } - bool supportsActiveState() const override { - return true; - } + bool supportsActiveState() const override { return true; } }; DummyImplTest() diff --git a/persistence/src/tests/proxy/mockprovider.h b/persistence/src/tests/proxy/mockprovider.h index b7019239847..a90b4cc27f7 100644 --- a/persistence/src/tests/proxy/mockprovider.h +++ b/persistence/src/tests/proxy/mockprovider.h @@ -20,34 +20,34 @@ struct MockProvider : PersistenceProvider { MockProvider() : last_called(NONE) {} - virtual Result initialize() override { + Result initialize() override { last_called = INITIALIZE; return Result(); } - virtual PartitionStateListResult getPartitionStates() const override { + PartitionStateListResult getPartitionStates() const override { last_called = GET_PARTITION_STATES; return PartitionStateListResult(PartitionStateList(1u)); } - virtual BucketIdListResult listBuckets(PartitionId id) const override { + BucketIdListResult listBuckets(PartitionId id) const override { last_called = LIST_BUCKETS; BucketIdListResult::List result; result.push_back(document::BucketId(id)); return BucketIdListResult(result); } - virtual Result setClusterState(const ClusterState &) override { + Result setClusterState(const ClusterState &) override { last_called = SET_CLUSTER_STATE; return Result(); } - virtual Result setActiveState(const Bucket &, BucketInfo::ActiveState) override { + Result setActiveState(const Bucket &, BucketInfo::ActiveState) override { last_called = SET_ACTIVE_STATE; return Result(); } - virtual BucketInfoResult getBucketInfo(const Bucket &bucket) const override { + BucketInfoResult getBucketInfo(const Bucket &bucket) const override { last_called = GET_BUCKET_INFO; return BucketInfoResult(BucketInfo(BucketChecksum(1), 2, 3, bucket.getBucketId().getRawId(), @@ -56,17 +56,17 @@ struct MockProvider : PersistenceProvider { BucketInfo::ACTIVE)); } - virtual Result put(const Bucket &, Timestamp, const DocumentSP&, Context&) override { + Result put(const Bucket &, Timestamp, const DocumentSP&, Context&) override { last_called = PUT; return Result(); } - virtual RemoveResult remove(const Bucket &, Timestamp, const DocumentId &, Context&) override { + RemoveResult remove(const Bucket &, Timestamp, const DocumentId &, Context&) override { last_called = REMOVE_BY_ID; return RemoveResult(true); } - virtual RemoveResult removeIfFound(const Bucket &, Timestamp, const DocumentId &, Context&) override { + RemoveResult removeIfFound(const Bucket &, Timestamp, const DocumentId &, Context&) override { last_called = REMOVE_IF_FOUND; return RemoveResult(true); } @@ -77,54 +77,54 @@ struct MockProvider : PersistenceProvider { return RemoveResult(true); } - virtual UpdateResult update(const Bucket &, Timestamp timestamp, const DocumentUpdateSP&, Context&) override { + UpdateResult update(const Bucket &, Timestamp timestamp, const DocumentUpdateSP&, Context&) override { last_called = UPDATE; return UpdateResult(Timestamp(timestamp - 10)); } - virtual Result flush(const Bucket&, Context&) override { + Result flush(const Bucket&, Context&) override { last_called = FLUSH; return Result(); } - virtual GetResult get(const Bucket &, const document::FieldSet&, const DocumentId&, Context&) const override { + GetResult get(const Bucket &, const document::FieldSet&, const DocumentId&, Context&) const override { last_called = GET; return GetResult(Document::UP(new Document), Timestamp(6u)); } - virtual CreateIteratorResult createIterator(const Bucket& bucket, - const document::FieldSet&, - const Selection&, - IncludedVersions, - Context&) override + CreateIteratorResult createIterator(const Bucket& bucket, + const document::FieldSet&, + const Selection&, + IncludedVersions, + Context&) override { last_called = CREATE_ITERATOR; return CreateIteratorResult(IteratorId(bucket.getPartition())); } - virtual IterateResult iterate(IteratorId, uint64_t, Context&) const override { + IterateResult iterate(IteratorId, uint64_t, Context&) const override { last_called = ITERATE; IterateResult::List result; result.push_back(DocEntry::UP(new DocEntry(Timestamp(1), 0))); return IterateResult(std::move(result), true); } - virtual Result destroyIterator(IteratorId, Context&) override { + Result destroyIterator(IteratorId, Context&) override { last_called = DESTROY_ITERATOR; return Result(); } - virtual Result createBucket(const Bucket&, Context&) override { + Result createBucket(const Bucket&, Context&) override { last_called = CREATE_BUCKET; return Result(); } - virtual Result deleteBucket(const Bucket&, Context&) override { + Result deleteBucket(const Bucket&, Context&) override { last_called = DELETE_BUCKET; return Result(); } - virtual BucketIdListResult getModifiedBuckets() const override { + BucketIdListResult getModifiedBuckets() const override { last_called = GET_MODIFIED_BUCKETS; BucketIdListResult::List list; list.push_back(document::BucketId(2)); @@ -132,30 +132,28 @@ struct MockProvider : PersistenceProvider { return BucketIdListResult(list); } - virtual Result split(const Bucket &, const Bucket &, const Bucket &, Context&) override - { + Result split(const Bucket &, const Bucket &, const Bucket &, Context&) override { last_called = SPLIT; return Result(); } - virtual Result join(const Bucket &, const Bucket &, const Bucket &, Context&) override - { + Result join(const Bucket &, const Bucket &, const Bucket &, Context&) override { last_called = JOIN; return Result(); } - virtual Result move(const Bucket &, PartitionId, Context&) override { + Result move(const Bucket &, PartitionId, Context&) override { last_called = MOVE; return Result(); } - virtual Result maintain(const Bucket &, MaintenanceLevel) override { + Result maintain(const Bucket &, MaintenanceLevel) override { last_called = MAINTAIN; return Result(); } - virtual Result removeEntry(const Bucket &, Timestamp, Context&) override { + Result removeEntry(const Bucket &, Timestamp, Context&) override { last_called = REMOVE_ENTRY; return Result(); } @@ -163,4 +161,3 @@ struct MockProvider : PersistenceProvider { } // namespace spi } // namespace storage - diff --git a/persistence/src/tests/proxy/providerproxy_conformancetest.cpp b/persistence/src/tests/proxy/providerproxy_conformancetest.cpp index a33b736a12d..cadcd3c224a 100644 --- a/persistence/src/tests/proxy/providerproxy_conformancetest.cpp +++ b/persistence/src/tests/proxy/providerproxy_conformancetest.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 <vespa/vespalib/testkit/test_kit.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/persistence/conformancetest/conformancetest.h> @@ -21,9 +20,7 @@ struct DummyFactory : Factory { return PersistenceProvider::UP(new dummy::DummyPersistence(repo, 4)); } - virtual bool - supportsActiveState() const override - { + bool supportsActiveState() const override { return true; } }; diff --git a/persistence/src/tests/proxy/proxy_factory_wrapper.h b/persistence/src/tests/proxy/proxy_factory_wrapper.h index 5d7899e7ff9..415d43e8033 100644 --- a/persistence/src/tests/proxy/proxy_factory_wrapper.h +++ b/persistence/src/tests/proxy/proxy_factory_wrapper.h @@ -2,7 +2,7 @@ #pragma once -#include <vespa/vespalib/util/vstringfmt.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/persistence/conformancetest/conformancetest.h> #include <vespa/persistence/proxy/providerstub.h> #include <vespa/persistence/proxy/providerproxy.h> @@ -33,7 +33,7 @@ struct ProxyFactoryWrapper : ConformanceTest::PersistenceFactory DummyProviderFactory::UP provider; Server::UP server; Wrapper(DummyProviderFactory::UP p, Server::UP s, const Repo &repo) - : Client(vespalib::make_vespa_string("tcp/localhost:%u", s->getPort()), repo), + : Client(vespalib::make_string("tcp/localhost:%u", s->getPort()), repo), provider(std::move(p)), server(std::move(s)) {} @@ -47,9 +47,7 @@ struct ProxyFactoryWrapper : ConformanceTest::PersistenceFactory return Provider::UP(new Wrapper(std::move(provider), std::move(server), *repo)); } - virtual bool - supportsActiveState() const override - { + bool supportsActiveState() const override { return factory->supportsActiveState(); } }; diff --git a/persistence/src/tests/proxy/proxyfactory.h b/persistence/src/tests/proxy/proxyfactory.h index 3a18440a6e7..1d0c7bd2db7 100644 --- a/persistence/src/tests/proxy/proxyfactory.h +++ b/persistence/src/tests/proxy/proxyfactory.h @@ -2,7 +2,6 @@ #pragma once -#include <vespa/vespalib/util/vstringfmt.h> #include <vespa/persistence/conformancetest/conformancetest.h> #include <vespa/persistence/proxy/providerstub.h> #include <vespa/persistence/proxy/providerproxy.h> @@ -30,12 +29,9 @@ struct ProxyFactory : ConformanceTest::PersistenceFactory return Provider::UP(new Client("tcp/localhost:3456", *repo)); } - virtual bool - supportsActiveState() const override - { + bool supportsActiveState() const override { return false; } }; } // namespace spi } // namespace storage - diff --git a/persistence/src/tests/testrunner.cpp b/persistence/src/tests/testrunner.cpp index 16027870c47..5baa0f60b6e 100644 --- a/persistence/src/tests/testrunner.cpp +++ b/persistence/src/tests/testrunner.cpp @@ -1,14 +1,12 @@ // 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 <iostream> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("persistencecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h index 1dee3fb60c3..a1656ce7ce1 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h @@ -144,14 +144,9 @@ public: BucketIdListResult getModifiedBuckets() const override; Result setClusterState(const ClusterState& newState) override; - - Result setActiveState(const Bucket& bucket, - BucketInfo::ActiveState newState) override; - + Result setActiveState(const Bucket& bucket, BucketInfo::ActiveState newState) override; BucketInfoResult getBucketInfo(const Bucket&) const override; - Result put(const Bucket&, Timestamp, const DocumentSP&, Context&) override; - GetResult get(const Bucket&, const document::FieldSet& fieldSet, const DocumentId&, @@ -185,7 +180,6 @@ public: Context&) override; Result revert(const Bucket&, Timestamp, Context&); - Result maintain(const Bucket& bucket, MaintenanceLevel level) override; /** @@ -242,4 +236,3 @@ private: } // dummy } // spi } // storage - diff --git a/persistence/src/vespa/persistence/proxy/providerstub.h b/persistence/src/vespa/persistence/proxy/providerstub.h index 27e726ca538..ce831547ef9 100644 --- a/persistence/src/vespa/persistence/proxy/providerstub.h +++ b/persistence/src/vespa/persistence/proxy/providerstub.h @@ -29,7 +29,7 @@ private: vespalib::ThreadStackExecutor &e, std::unique_ptr<PersistenceProvider> &p) : FNET_Task(s), executor(e), provider(p) {} - virtual void PerformTask() override { + void PerformTask() override { executor.sync(); assert(provider.get() != 0); provider.reset(); diff --git a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp index 29ea819f71d..a9b2a50cac3 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp @@ -2,14 +2,10 @@ #include "attributefactory.h" #include "defines.h" - #include "attributevector.hpp" #include "multivalueattribute.hpp" #include "multinumericattribute.hpp" -#include "multistringattribute.h" - -#include <vespa/log/log.h> -LOG_SETUP(".createarraystd"); +#include "multistringattribute.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp index 5aa40a20d14..262ec2c23df 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp @@ -1,16 +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/searchlib/attribute/attributefactory.h> +#include "attributefactory.h" #include "defines.h" - -#include <vespa/log/log.h> -LOG_SETUP(".createsetstd"); - -#include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/attribute/multivalueattribute.hpp> -#include <vespa/searchlib/attribute/multinumericattribute.hpp> -#include <vespa/searchlib/attribute/multistringattribute.h> +#include "attributevector.hpp" +#include "multivalueattribute.hpp" +#include "multinumericattribute.hpp" +#include "multistringattribute.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp index 02890eb8789..ad08e20808a 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp @@ -1,21 +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/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> +#include "attributefactory.h" +#include "integerbase.h" +#include "floatbase.h" #include "defines.h" - -#include <vespa/log/log.h> -LOG_SETUP(".createsinglefastsearch"); - -#include <vespa/searchlib/attribute/singlestringattribute.h> -#include <vespa/searchlib/attribute/singlestringpostattribute.hpp> -#include <vespa/searchlib/attribute/singlenumericenumattribute.hpp> -#include <vespa/searchlib/attribute/singlenumericpostattribute.hpp> -#include <vespa/searchlib/attribute/enumstore.hpp> -#include <vespa/searchlib/attribute/enumattribute.hpp> -#include <vespa/searchlib/attribute/singleenumattribute.hpp> +#include "singlestringattribute.h" +#include "singlestringpostattribute.hpp" +#include "singlenumericenumattribute.hpp" +#include "singlenumericpostattribute.hpp" +#include "enumstore.hpp" +#include "enumattribute.hpp" +#include "singleenumattribute.hpp" #define INTPOSTING(T) SingleValueNumericPostingAttribute< ENUM_ATTRIBUTE(IntegerAttributeTemplate<T>) > #define FLOATPOSTING(T) SingleValueNumericPostingAttribute< ENUM_ATTRIBUTE(FloatingPointAttributeTemplate<T>) > diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp index 766195c8e9c..c3a126631e6 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp @@ -1,17 +1,12 @@ // 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/searchlib/attribute/attributefactory.h> - -#include <vespa/log/log.h> -LOG_SETUP(".createsinglestd"); - +#include "attributefactory.h" #include "predicate_attribute.h" #include "singlesmallnumericattribute.h" #include "reference_attribute.h" -#include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/attribute/singlenumericattribute.hpp> -#include <vespa/searchlib/attribute/singlestringattribute.h> +#include "attributevector.hpp" +#include "singlenumericattribute.hpp" +#include "singlestringattribute.h" #include <vespa/searchlib/tensor/generic_tensor_attribute.h> #include <vespa/searchlib/tensor/dense_tensor_attribute.h> diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.h b/searchlib/src/vespa/searchlib/attribute/enumattribute.h index 94e5da62967..ca5058c71d3 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.h @@ -2,9 +2,9 @@ #pragma once -#include <vespa/searchlib/attribute/enumstore.h> #include "attributevector.h" #include "loadedenumvalue.h" +#include <vespa/searchlib/attribute/enumstore.h> #include <set> namespace search { @@ -61,18 +61,10 @@ protected: virtual EnumType getFromEnum(EnumHandle e) const { return _enumStore.getValue(e); } virtual void fillPostings(LoadedVector & loaded) { (void) loaded; } - virtual void fillEnum(LoadedVector & loaded) override; - - virtual void - fillEnum0(const void *src, - size_t srcLen, - EnumIndexVector &eidxs) override; - - virtual void - fixupEnumRefCounts(const EnumVector &enumHist) override; - - virtual uint64_t - getUniqueValueCount(void) const override; + void fillEnum(LoadedVector & loaded) override; + void fillEnum0(const void *src, size_t srcLen, EnumIndexVector &eidxs) override; + void fixupEnumRefCounts(const EnumVector &enumHist) override; + uint64_t getUniqueValueCount(void) const override; static EnumType getDefaultEnumTypeValue() { return B::defaultValue(); } @@ -90,9 +82,8 @@ public: EnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); - virtual ~EnumAttribute(); + ~EnumAttribute(); virtual bool findEnum(EnumType v, EnumHandle & e) const { return _enumStore.findEnum(v, e); } }; } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.h b/searchlib/src/vespa/searchlib/attribute/flagattribute.h index ea73ecb7c51..3fe2424b97d 100644 --- a/searchlib/src/vespa/searchlib/attribute/flagattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.h @@ -40,8 +40,7 @@ public: void setNewBVValue(DocId doc, typename B::WType::ValueType value); private: - virtual bool onAddDoc(DocId doc) override; - + bool onAddDoc(DocId doc) override; void onAddDocs(DocId docIdLimit) override; void ensureGuardBit(BitVector & bv); void ensureGuardBit(); diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h index 6afede8d3b4..01d9efe0cbc 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h @@ -256,4 +256,3 @@ public: }; } - diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp b/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp index 737f464206e..79a2d2001b6 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.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 "multistringattribute.h" -#include "multistringattribute.hpp" -#include <vespa/log/log.h> +#include <vespa/searchlib/query/queryterm.h> -LOG_SETUP(".searchlib.attribute.multistringattribute"); namespace search { template class MultiValueStringAttributeT<EnumAttribute<StringAttribute>, multivalue::Value<EnumStoreBase::Index> >; diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h index 12b1098bbb3..e02a81e44ef 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h @@ -3,7 +3,6 @@ #pragma once #include "multi_value_mapping.h" -#include <vespa/vespalib/stllike/string.h> #include "attributevector.h" namespace search { @@ -48,7 +47,7 @@ protected: * Can be overridden by subclasses that need to resize structures as a result of this. * Should return true if underlying structures were resized. **/ - virtual bool onAddDoc(DocId doc) override { (void) doc; return false; } + bool onAddDoc(DocId doc) override { (void) doc; return false; } AddressSpace getMultiValueAddressSpaceUsage() const override; @@ -74,4 +73,3 @@ public: }; } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.h b/searchlib/src/vespa/searchlib/attribute/numericbase.h index 94bc5c1472d..ee6effa810a 100644 --- a/searchlib/src/vespa/searchlib/attribute/numericbase.h +++ b/searchlib/src/vespa/searchlib/attribute/numericbase.h @@ -3,9 +3,9 @@ #pragma once #include "attributevector.h" -#include <vespa/searchlib/common/sort.h> -#include <vespa/searchlib/attribute/enumstorebase.h> +#include "enumstorebase.h" #include "loadedenumvalue.h" +#include <vespa/searchlib/common/sort.h> namespace search { @@ -28,6 +28,7 @@ protected: virtual void fillEnumIdx(ReaderBase &attrReader, const EnumIndexVector &eidxs, EnumVector &enumHist); virtual void fillPostingsFixupEnum(const attribute::LoadedEnumAttributeVector &loaded); virtual void fixupEnumRefCounts(const EnumVector &enumHist); + bool onAddDoc(DocId) override { return true; } template<typename T> class Equal @@ -57,8 +58,7 @@ protected: protected: Range(const QueryTermSimple & queryTerm, bool avoidUndefinedInRange=false); Int64Range getRange() const { - return Int64Range(static_cast<int64_t>(_low), - static_cast<int64_t>(_high)); + return Int64Range(static_cast<int64_t>(_low), static_cast<int64_t>(_high)); } bool isValid() const { return _valid; } bool match(T v) const { return (_low <= v) && (v <= _high); } @@ -75,8 +75,7 @@ protected: BaseType numMin = std::numeric_limits<BaseType>::min(); BaseType numMax = std::numeric_limits<BaseType>::max(); - if (isFloat) - { + if (isFloat) { if (_low <= (-numMax)) { low = -numMax; } @@ -102,4 +101,3 @@ public: }; } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h index 1843bde4d54..a835aa85896 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h @@ -2,7 +2,7 @@ #pragma once -#include <vespa/searchlib/attribute/enumattribute.h> +#include "enumattribute.h" #include <vespa/searchlib/common/rcuvector.h> namespace search { @@ -83,7 +83,8 @@ protected: } virtual void mergeMemoryStats(MemoryUsage & total) { (void) total; } - virtual void fillValues(LoadedVector & loaded) override; + + void fillValues(LoadedVector & loaded) override; void fillEnumIdx(ReaderBase &attrReader, const EnumStoreBase::IndexVector &eidxs, @@ -101,7 +102,7 @@ protected: * * Should return true if underlying structures were resized. **/ - virtual bool onAddDoc(DocId doc) override; + bool onAddDoc(DocId doc) override; public: SingleValueEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); @@ -136,4 +137,3 @@ public: }; } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index c798351211a..4b19f8d1af0 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -2,8 +2,8 @@ #pragma once -#include <vespa/searchlib/attribute/singleenumattribute.h> -#include <vespa/searchlib/attribute/enumattribute.hpp> +#include "singleenumattribute.h" +#include "enumattribute.hpp" #include "ipostinglistattributebase.h" #include "singleenumattributesaver.h" #include "load_utils.h" diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h index 828c1434819..369fbf77f0b 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h @@ -46,9 +46,9 @@ private: protected: // from SingleValueEnumAttribute - virtual void considerUpdateAttributeChange(const Change & c); - virtual void considerArithmeticAttributeChange(const Change & c, UniqueSet & newUniques); - virtual void applyArithmeticValueChange(const Change & c, EnumStoreBase::IndexVector & unused); + void considerUpdateAttributeChange(const Change & c) override; + void considerArithmeticAttributeChange(const Change & c, UniqueSet & newUniques) override; + void applyArithmeticValueChange(const Change & c, EnumStoreBase::IndexVector & unused) override; /* * Specialization of SearchContext @@ -92,9 +92,10 @@ public: const AttributeVector::Config & c = AttributeVector::Config(AttributeVector::BasicType::fromType(T()), attribute::CollectionType::SINGLE)); + ~SingleValueNumericEnumAttribute(); - virtual void onCommit(); - virtual bool onLoad(); + void onCommit() override; + bool onLoad() override; bool onLoadEnumerated(ReaderBase &attrReader); @@ -104,46 +105,46 @@ public: //------------------------------------------------------------------------- // Attribute read API //------------------------------------------------------------------------- - virtual T get(DocId doc) const { + T get(DocId doc) const override { return this->_enumStore.getValue(this->_enumIndices[doc]); } - virtual largeint_t getInt(DocId doc) const { + largeint_t getInt(DocId doc) const override { return static_cast<largeint_t>(get(doc)); } - virtual double getFloat(DocId doc) const { + double getFloat(DocId doc) const override { return static_cast<double>(get(doc)); } - virtual uint32_t getAll(DocId doc, T * v, uint32_t sz) const { + uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { if (sz > 0) { v[0] = get(doc); } return 1; } - virtual uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const { + uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { if (sz > 0) { v[0] = getInt(doc); } return 1; } - virtual uint32_t get(DocId doc, double * v, uint32_t sz) const { + uint32_t get(DocId doc, double * v, uint32_t sz) const override { if (sz > 0) { v[0] = getFloat(doc); } return 1; } - virtual uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const { + uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { if (sz > 0) { v[0] = Weighted(get(doc)); } return 1; } - virtual uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const { + uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { if (sz > 0) { v[0] = WeightedInt(getInt(doc)); } return 1; } - virtual uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const { + uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const override { if (sz > 0) { v[0] = WeightedFloat(getFloat(doc)); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp index fbf56440a08..698bdbf82d4 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp @@ -64,6 +64,9 @@ SingleValueNumericEnumAttribute(const vespalib::string & baseFileName, } template <typename B> +SingleValueNumericEnumAttribute<B>::~SingleValueNumericEnumAttribute() {} + +template <typename B> void SingleValueNumericEnumAttribute<B>::onCommit() { diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h index 4a30c0ecb1b..b94d1717ed1 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h @@ -156,8 +156,8 @@ public: protected: const A * _attribute; private: - virtual size_t getAttributeValues(uint32_t docid, const AT * & count) override; -public: + size_t getAttributeValues(uint32_t docid, const AT * & count) override; + public: DotProductExecutor(const A * attribute, const V & queryVector); ~DotProductExecutor(); }; diff --git a/searchlib/src/vespa/searchlib/features/raw_score_feature.h b/searchlib/src/vespa/searchlib/features/raw_score_feature.h index ddae8848052..2e37c43c8f7 100644 --- a/searchlib/src/vespa/searchlib/features/raw_score_feature.h +++ b/searchlib/src/vespa/searchlib/features/raw_score_feature.h @@ -8,39 +8,37 @@ namespace search { namespace features { -class RawScoreExecutor : public search::fef::FeatureExecutor +class RawScoreExecutor : public fef::FeatureExecutor { private: - std::vector<search::fef::TermFieldHandle> _handles; + std::vector<fef::TermFieldHandle> _handles; const fef::MatchData *_md; - virtual void handle_bind_match_data(fef::MatchData &md) override; + void handle_bind_match_data(fef::MatchData &md) override; public: - RawScoreExecutor(const search::fef::IQueryEnvironment &env, uint32_t fieldId); - virtual void execute(uint32_t docId) override; + RawScoreExecutor(const fef::IQueryEnvironment &env, uint32_t fieldId); + void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- -class RawScoreBlueprint : public search::fef::Blueprint +class RawScoreBlueprint : public fef::Blueprint { private: - const search::fef::FieldInfo *_field; + const fef::FieldInfo *_field; public: RawScoreBlueprint() : Blueprint("rawScore"), _field(0) {} - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const override {} - virtual search::fef::Blueprint::UP createInstance() const override { + void visitDumpFeatures(const fef::IIndexEnvironment &, + fef::IDumpFeatureVisitor &) const override {} + fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new RawScoreBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().field(); + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().field(); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; } // namespace features } // namespace search - diff --git a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h index 7dad54e65d5..020cc25a2f9 100644 --- a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h @@ -1,8 +1,6 @@ // 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> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/featureexecutor.h> @@ -23,7 +21,7 @@ struct ReverseProximityConfig { /** * Implements the executor for reverse proximity. */ -class ReverseProximityExecutor : public search::fef::FeatureExecutor { +class ReverseProximityExecutor : public fef::FeatureExecutor { public: /** * Constructs an executor for reverse proximity. @@ -31,48 +29,32 @@ public: * @param env The query environment. * @param config The completeness config. */ - ReverseProximityExecutor(const search::fef::IQueryEnvironment &env, + ReverseProximityExecutor(const fef::IQueryEnvironment &env, const ReverseProximityConfig &config); - virtual void execute(uint32_t docId) override; + void execute(uint32_t docId) override; private: const ReverseProximityConfig &_config; // The proximity config. - search::fef::TermFieldHandle _termA; // Handle to the first query term. - search::fef::TermFieldHandle _termB; // Handle to the second query term. + fef::TermFieldHandle _termA; // Handle to the first query term. + fef::TermFieldHandle _termB; // Handle to the second query term. const fef::MatchData *_md; - virtual void handle_bind_match_data(fef::MatchData &md) override; + void handle_bind_match_data(fef::MatchData &md) override; }; /** * Implements the blueprint for proximity. */ -class ReverseProximityBlueprint : public search::fef::Blueprint { +class ReverseProximityBlueprint : public fef::Blueprint { public: - /** - * Constructs a blueprint for reverse proximity. - */ ReverseProximityBlueprint(); - - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const override; - - // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::ANY).number().number(); + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().indexField(fef::ParameterCollection::ANY).number().number(); } - - // Inherit doc from Blueprint. - virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params) override; - - // Inherit doc from Blueprint. - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; - + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; private: ReverseProximityConfig _config; }; diff --git a/searchlib/src/vespa/searchlib/features/subqueries_feature.h b/searchlib/src/vespa/searchlib/features/subqueries_feature.h index 217548b3e96..0c882a9b24a 100644 --- a/searchlib/src/vespa/searchlib/features/subqueries_feature.h +++ b/searchlib/src/vespa/searchlib/features/subqueries_feature.h @@ -8,37 +8,33 @@ namespace search { namespace features { -class SubqueriesExecutor : public search::fef::FeatureExecutor { - std::vector<search::fef::TermFieldHandle> _handles; - const fef::MatchData *_md; - - virtual void handle_bind_match_data(fef::MatchData &md) override; +class SubqueriesExecutor : public fef::FeatureExecutor { + std::vector<fef::TermFieldHandle> _handles; + const fef::MatchData *_md; + void handle_bind_match_data(fef::MatchData &md) override; public: - SubqueriesExecutor(const search::fef::IQueryEnvironment &env, - uint32_t fieldId); - virtual void execute(uint32_t docId) override; + SubqueriesExecutor(const fef::IQueryEnvironment &env, uint32_t fieldId); + void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- -class SubqueriesBlueprint : public search::fef::Blueprint +class SubqueriesBlueprint : public fef::Blueprint { private: - const search::fef::FieldInfo *_field; + const fef::FieldInfo *_field; public: SubqueriesBlueprint() : Blueprint("subqueries"), _field(nullptr) {} - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const override {} - virtual search::fef::Blueprint::UP createInstance() const override { + void visitDumpFeatures(const fef::IIndexEnvironment &, fef::IDumpFeatureVisitor &) const override {} + fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new SubqueriesBlueprint); } - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().field(); + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().field(); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; } // namespace features diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h index eba2a9f44ae..4f368a9e188 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h @@ -34,7 +34,7 @@ public: { _attrBuffer.allocate(_attribute->getMaxValueCount()); } - virtual void execute(uint32_t docId) override; + void execute(uint32_t docId) override; }; template <typename WeightedBufferType> diff --git a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h index ef3d83de98d..6c574aa90b4 100644 --- a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h +++ b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h @@ -16,16 +16,14 @@ namespace features { **/ class TermFieldMdExecutor : public fef::FeatureExecutor { - typedef std::pair<search::fef::TermFieldHandle, query::Weight> Element; + typedef std::pair<fef::TermFieldHandle, query::Weight> Element; std::vector<Element> _terms; const fef::MatchData *_md; - virtual void execute(uint32_t docId) override; - virtual void handle_bind_match_data(fef::MatchData &md) override; - + void execute(uint32_t docId) override; + void handle_bind_match_data(fef::MatchData &md) override; public: - TermFieldMdExecutor(const search::fef::IQueryEnvironment &env, - uint32_t fieldId); + TermFieldMdExecutor(const fef::IQueryEnvironment &env, uint32_t fieldId); }; @@ -33,31 +31,18 @@ public: * Implements the blueprint for the term field md executor. **/ class TermFieldMdBlueprint : public fef::Blueprint { - const search::fef::FieldInfo * _field; + const fef::FieldInfo * _field; public: TermFieldMdBlueprint(); - - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const fef::IIndexEnvironment & env, - fef::IDumpFeatureVisitor & visitor) const override; - - // Inherit doc from Blueprint. - virtual fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual fef::ParameterDescriptions getDescriptions() const override { + void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { return fef::ParameterDescriptions().desc().field(); } - - // Inherit doc from Blueprint. - virtual bool setup(const fef::IIndexEnvironment & env, - const fef::ParameterList & params) override; - - // Inherit doc from Blueprint. - virtual fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment & env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment & env, vespalib::Stash &stash) const override; }; } // namespace features } // namespace search - diff --git a/searchlib/src/vespa/searchlib/features/termdistancefeature.h b/searchlib/src/vespa/searchlib/features/termdistancefeature.h index ed79a51c199..609ea6d1b63 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termdistancefeature.h @@ -23,7 +23,7 @@ struct TermDistanceParams { /** * Implements the executor for calculating min term distance (forward and reverse). **/ -class TermDistanceExecutor : public search::fef::FeatureExecutor +class TermDistanceExecutor : public fef::FeatureExecutor { private: const TermDistanceParams & _params; @@ -34,44 +34,31 @@ private: virtual void handle_bind_match_data(fef::MatchData &md) override; public: - TermDistanceExecutor(const search::fef::IQueryEnvironment & env, + TermDistanceExecutor(const fef::IQueryEnvironment & env, const TermDistanceParams & params); - virtual void execute(uint32_t docId) override; - bool valid() const; + void execute(uint32_t docId) override; + bool valid() const; }; /** * Implements the blueprint for the term distance executor. **/ -class TermDistanceBlueprint : public search::fef::Blueprint { +class TermDistanceBlueprint : public fef::Blueprint { private: TermDistanceParams _params; public: TermDistanceBlueprint(); - - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment & env, - search::fef::IDumpFeatureVisitor & visitor) const override; - - // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::ANY).number().number(); + void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().indexField(fef::ParameterCollection::ANY).number().number(); } - - // Inherit doc from Blueprint. - virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params) override; - - // Inherit doc from Blueprint. - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; } // namespace features } // namespace search - diff --git a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h index 26faaae4b93..c7ef3d672fd 100644 --- a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h @@ -1,8 +1,6 @@ // 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> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/common/feature.h> @@ -45,14 +43,14 @@ struct TermEditDistanceConfig { /** * Implements the executor for the term edit distance calculator. */ -class TermEditDistanceExecutor : public search::fef::FeatureExecutor { +class TermEditDistanceExecutor : public fef::FeatureExecutor { public: /** * Constructs a new executor for the term edit distance calculator. * * @param config The config for this executor. */ - TermEditDistanceExecutor(const search::fef::IQueryEnvironment &env, + TermEditDistanceExecutor(const fef::IQueryEnvironment &env, const TermEditDistanceConfig &config); @@ -80,7 +78,7 @@ public: * * @param docid local document id to be evaluated */ - virtual void execute(uint32_t docId) override; + void execute(uint32_t docId) override; private: /** @@ -91,11 +89,11 @@ private: */ void logRow(const std::vector<TedCell> &row, size_t numCols); - virtual void handle_bind_match_data(fef::MatchData &md) override; + void handle_bind_match_data(fef::MatchData &md) override; private: const TermEditDistanceConfig &_config; // The config for this executor. - std::vector<search::fef::TermFieldHandle> _fieldHandles; // The handles of all query terms. + std::vector<fef::TermFieldHandle> _fieldHandles; // The handles of all query terms. std::vector<feature_t> _termWeights; // The weights of all query terms. std::vector<TedCell> _prevRow; // Optimized representation of the cost table. std::vector<TedCell> _thisRow; // @@ -105,26 +103,17 @@ private: /** * Implements the blueprint for the term edit distance calculator. */ -class TermEditDistanceBlueprint : public search::fef::Blueprint { +class TermEditDistanceBlueprint : public fef::Blueprint { public: /** * Constructs a new blueprint for the term edit distance calculator. */ TermEditDistanceBlueprint(); - - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const override; - - // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; - - // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::SINGLE); + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().indexField(fef::ParameterCollection::SINGLE); } /** @@ -143,12 +132,10 @@ public: * @param params A list of the parameters mentioned above. * @return Whether or not setup was possible. */ - virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params) override; + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; private: TermEditDistanceConfig _config; // The config for this blueprint. }; }} - diff --git a/searchlib/src/vespa/searchlib/features/termfeature.h b/searchlib/src/vespa/searchlib/features/termfeature.h index cb4b92dfc11..cd42333f44b 100644 --- a/searchlib/src/vespa/searchlib/features/termfeature.h +++ b/searchlib/src/vespa/searchlib/features/termfeature.h @@ -1,8 +1,6 @@ // 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> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/common/feature.h> @@ -13,7 +11,7 @@ namespace features { /** * Implements the executor for term feature. */ -class TermExecutor : public search::fef::FeatureExecutor { +class TermExecutor : public fef::FeatureExecutor { public: /** * Constructs an executor for term feature. @@ -21,48 +19,32 @@ public: * @param env The query environment. * @param termId The id of the query term to evaluate. */ - TermExecutor(const search::fef::IQueryEnvironment &env, - uint32_t termId); - virtual void execute(uint32_t docId) override; + TermExecutor(const fef::IQueryEnvironment &env, uint32_t termId); + void execute(uint32_t docId) override; private: - const search::fef::ITermData *_termData; - feature_t _connectedness; - feature_t _significance; + const fef::ITermData *_termData; + feature_t _connectedness; + feature_t _significance; }; /** * Implements the blueprint for term feature. */ -class TermBlueprint : public search::fef::Blueprint { +class TermBlueprint : public fef::Blueprint { public: - /** - * Constructs a blueprint for term feature. - */ TermBlueprint(); - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const override; - - // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().number(); + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().number(); } - - // Inherit doc from Blueprint. - virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params) override; - - // Inherit doc from Blueprint. - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; private: uint32_t _termId; }; }} - diff --git a/searchlib/src/vespa/searchlib/features/terminfofeature.h b/searchlib/src/vespa/searchlib/features/terminfofeature.h index 7f1d8b8a6e2..962b35fc936 100644 --- a/searchlib/src/vespa/searchlib/features/terminfofeature.h +++ b/searchlib/src/vespa/searchlib/features/terminfofeature.h @@ -2,30 +2,26 @@ #pragma once -#include <string> -#include <vector> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/featureexecutor.h> namespace search { namespace features { -class TermInfoBlueprint : public search::fef::Blueprint +class TermInfoBlueprint : public fef::Blueprint { private: uint32_t _termIdx; public: TermInfoBlueprint(); - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &indexEnv, - search::fef::IDumpFeatureVisitor &visitor) const override; - virtual search::fef::Blueprint::UP createInstance() const override { return search::fef::Blueprint::UP(new TermInfoBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().number(); + void visitDumpFeatures(const fef::IIndexEnvironment &indexEnv, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override { return fef::Blueprint::UP(new TermInfoBlueprint()); } + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().number(); } - virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; }; } // namespace features diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h index 084d1dd4b1c..b47a7112a0c 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h @@ -2,8 +2,6 @@ #pragma once -#include <string> -#include <vector> #include <vespa/searchlib/fef/fef.h> #include <vespa/vespalib/util/priority_queue.h> @@ -12,7 +10,7 @@ namespace features { //----------------------------------------------------------------------------- -class TextSimilarityExecutor : public search::fef::FeatureExecutor +class TextSimilarityExecutor : public fef::FeatureExecutor { private: std::vector<fef::TermFieldHandle> _handles; @@ -21,11 +19,11 @@ private: struct Item { uint32_t idx; - search::fef::TermFieldMatchData::PositionsIterator pos; - search::fef::TermFieldMatchData::PositionsIterator end; + fef::TermFieldMatchData::PositionsIterator pos; + fef::TermFieldMatchData::PositionsIterator end; Item(uint32_t idx_in, - search::fef::TermFieldMatchData::PositionsIterator pos_in, - search::fef::TermFieldMatchData::PositionsIterator end_in) + fef::TermFieldMatchData::PositionsIterator pos_in, + fef::TermFieldMatchData::PositionsIterator end_in) : idx(idx_in), pos(pos_in), end(end_in) {} bool operator<(const Item &other) const { return (pos->getPosition() == other.pos->getPosition()) @@ -37,17 +35,17 @@ private: vespalib::PriorityQueue<Item> _queue; const fef::MatchData *_md; - virtual void handle_bind_match_data(fef::MatchData &md) override; + void handle_bind_match_data(fef::MatchData &md) override; public: - TextSimilarityExecutor(const search::fef::IQueryEnvironment &env, uint32_t field_id); - virtual bool isPure() override { return _handles.empty(); } - virtual void execute(uint32_t docId) override; + TextSimilarityExecutor(const fef::IQueryEnvironment &env, uint32_t field_id); + bool isPure() override { return _handles.empty(); } + void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- -class TextSimilarityBlueprint : public search::fef::Blueprint +class TextSimilarityBlueprint : public fef::Blueprint { private: static const vespalib::string score_output; @@ -60,15 +58,13 @@ private: public: TextSimilarityBlueprint(); - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const override; - virtual search::fef::Blueprint::UP createInstance() const override; - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::SINGLE); + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().indexField(fef::ParameterCollection::SINGLE); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; //----------------------------------------------------------------------------- diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h index 8130c35dc2c..3d99b55f414 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h @@ -113,30 +113,30 @@ public: void illegalVisit() {} - virtual void visit(search::query::And &) override { illegalVisit(); } - virtual void visit(search::query::AndNot &) override { illegalVisit(); } - virtual void visit(search::query::Equiv &) override { illegalVisit(); } - virtual void visit(search::query::Near &) override { illegalVisit(); } - virtual void visit(search::query::ONear &) override { illegalVisit(); } - virtual void visit(search::query::Or &) override { illegalVisit(); } - virtual void visit(search::query::Rank &) override { illegalVisit(); } - virtual void visit(search::query::WeakAnd &) override { illegalVisit(); } - - virtual void visit(search::query::Phrase &n) override { + void visit(search::query::And &) override { illegalVisit(); } + void visit(search::query::AndNot &) override { illegalVisit(); } + void visit(search::query::Equiv &) override { illegalVisit(); } + void visit(search::query::Near &) override { illegalVisit(); } + void visit(search::query::ONear &) override { illegalVisit(); } + void visit(search::query::Or &) override { illegalVisit(); } + void visit(search::query::Rank &) override { illegalVisit(); } + void visit(search::query::WeakAnd &) override { illegalVisit(); } + + void visit(search::query::Phrase &n) override { visitPhrase(n); } - virtual void visit(search::query::WeightedSetTerm &n) override { visitWeightedSetTerm(n); } - virtual void visit(search::query::DotProduct &n) override { visitDotProduct(n); } - virtual void visit(search::query::WandTerm &n) override { visitWandTerm(n); } - - virtual void visit(search::query::NumberTerm &n) override = 0; - virtual void visit(search::query::LocationTerm &n) override = 0; - virtual void visit(search::query::PrefixTerm &n) override = 0; - virtual void visit(search::query::RangeTerm &n) override = 0; - virtual void visit(search::query::StringTerm &n) override = 0; - virtual void visit(search::query::SubstringTerm &n) override = 0; - virtual void visit(search::query::SuffixTerm &n) override = 0; - virtual void visit(search::query::RegExpTerm &n) override = 0; + void visit(search::query::WeightedSetTerm &n) override { visitWeightedSetTerm(n); } + void visit(search::query::DotProduct &n) override { visitDotProduct(n); } + void visit(search::query::WandTerm &n) override { visitWandTerm(n); } + + void visit(search::query::NumberTerm &n) override = 0; + void visit(search::query::LocationTerm &n) override = 0; + void visit(search::query::PrefixTerm &n) override = 0; + void visit(search::query::RangeTerm &n) override = 0; + void visit(search::query::StringTerm &n) override = 0; + void visit(search::query::SubstringTerm &n) override = 0; + void visit(search::query::SuffixTerm &n) override = 0; + void visit(search::query::RegExpTerm &n) override = 0; }; } // namespace search::queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp index 6732f37482d..974d7fd1ca5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp @@ -1,9 +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 "equivsearch.h" -#include <vespa/vespalib/objects/visit.h> -#include <vespa/searchlib/fef/termmatchdatamerger.h> namespace search { namespace queryeval { @@ -17,7 +14,7 @@ private: bool _valid; protected: - virtual void doUnpack(uint32_t docid) override; + void doUnpack(uint32_t docid) override; public: /** diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_search.h b/searchlib/src/vespa/searchlib/queryeval/fake_search.h index 3ba3d2cf439..020f045f49d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_search.h @@ -34,12 +34,11 @@ public: { assert(_tfmda.size() == 1); } - virtual void doSeek(uint32_t docid) override; - virtual void doUnpack(uint32_t docid) override; - virtual const PostingInfo *getPostingInfo() const override { return _result.postingInfo(); } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; + void doSeek(uint32_t docid) override; + void doUnpack(uint32_t docid) override; + const PostingInfo *getPostingInfo() const override { return _result.postingInfo(); } + void visitMembers(vespalib::ObjectVisitor &visitor) const override; }; } // namespace queryeval } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp index 9e7e7ed6c9a..6aadb33c035 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp @@ -54,15 +54,15 @@ public: template <class TermNode> void visitTerm(TermNode &n); - virtual void visit(NumberTerm &n) override { visitTerm(n); } - virtual void visit(LocationTerm &n) override { visitTerm(n); } - virtual void visit(PrefixTerm &n) override { visitTerm(n); } - virtual void visit(RangeTerm &n) override { visitTerm(n); } - virtual void visit(StringTerm &n) override { visitTerm(n); } - virtual void visit(SubstringTerm &n) override { visitTerm(n); } - virtual void visit(SuffixTerm &n) override { visitTerm(n); } - virtual void visit(PredicateQuery &n) override { visitTerm(n); } - virtual void visit(RegExpTerm &n) override { visitTerm(n); } + void visit(NumberTerm &n) override { visitTerm(n); } + void visit(LocationTerm &n) override { visitTerm(n); } + void visit(PrefixTerm &n) override { visitTerm(n); } + void visit(RangeTerm &n) override { visitTerm(n); } + void visit(StringTerm &n) override { visitTerm(n); } + void visit(SubstringTerm &n) override { visitTerm(n); } + void visit(SuffixTerm &n) override { visitTerm(n); } + void visit(PredicateQuery &n) override { visitTerm(n); } + void visit(RegExpTerm &n) override { visitTerm(n); } }; template <class Map> diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h index 34b6e250797..822cf439ad6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h @@ -55,12 +55,11 @@ public: const vespalib::string &term, const FakeResult &result); - // inherited from Searchable using Searchable::createBlueprint; - virtual Blueprint::UP createBlueprint(const IRequestContext & requestContext, - const FieldSpec &field, - const search::query::Node &term) override; - virtual ~FakeSearchable(); + Blueprint::UP createBlueprint(const IRequestContext & requestContext, + const FieldSpec &field, + const search::query::Node &term) override; + ~FakeSearchable(); }; } // namespace search::queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp index 9a91bf6e2b8..95615c8b923 100644 --- a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp @@ -1,15 +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/log/log.h> -LOG_SETUP(".get_weight_from_node"); - #include "get_weight_from_node.h" #include <vespa/searchlib/query/tree/intermediatenodes.h> -#include <vespa/searchlib/query/tree/node.h> #include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/query/tree/templatetermvisitor.h> -#include <vespa/searchlib/query/tree/termnodes.h> using search::query::Node; using search::query::SimpleQueryNodeTypes; @@ -31,7 +25,7 @@ struct WeightExtractor : public TemplateTermVisitor<WeightExtractor, } // Treat Equiv nodes as terms. - virtual void visit(search::query::Equiv &n) override { visitTerm(n); } + void visit(search::query::Equiv &n) override { visitTerm(n); } }; } // namespace search::queryeval::<unnamed> diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp index 64776b99f16..65b1257b105 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp @@ -542,7 +542,7 @@ class FindSource : public Blueprint::IPredicate { public: FindSource(uint32_t sourceId) : _sourceId(sourceId) { } - virtual bool check(const Blueprint & bp) const override { return bp.getSourceId() == _sourceId; } + bool check(const Blueprint & bp) const override { return bp.getSourceId() == _sourceId; } private: uint32_t _sourceId; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h index d910499b463..c0b3c9a9ff6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h @@ -81,15 +81,14 @@ public: vespalib::string toString() const { return _str; } - // Overrides ObjectVisitor - virtual void openStruct(const vespalib::string &name, const vespalib::string &type) override; - virtual void closeStruct() override; - virtual void visitBool(const vespalib::string &name, bool value) override; - virtual void visitInt(const vespalib::string &name, int64_t value) override; - virtual void visitFloat(const vespalib::string &name, double value) override; - virtual void visitString(const vespalib::string &name, const vespalib::string &value) override; - virtual void visitNull(const vespalib::string &name) override; - virtual void visitNotImplemented() override; + void openStruct(const vespalib::string &name, const vespalib::string &type) override; + void closeStruct() override; + void visitBool(const vespalib::string &name, bool value) override; + void visitInt(const vespalib::string &name, int64_t value) override; + void visitFloat(const vespalib::string &name, double value) override; + void visitString(const vespalib::string &name, const vespalib::string &value) override; + void visitNull(const vespalib::string &name) override; + void visitNotImplemented() override; }; typedef std::unique_ptr<MonitoringSearchIterator> UP; @@ -115,7 +114,7 @@ public: SearchIterator::initRange(_search->getDocId()+1, _search->getEndId()); } Trinary is_strict() const override { return _search->is_strict(); } - virtual const PostingInfo *getPostingInfo() const override; + const PostingInfo *getPostingInfo() const override; void visitMembers(vespalib::ObjectVisitor &visitor) const override; const SearchIterator &getIterator() const { return *_search; } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearsearch.h b/searchlib/src/vespa/searchlib/queryeval/nearsearch.h index 6ba631abb16..96dd497fb7c 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/nearsearch.h @@ -77,10 +77,8 @@ public: uint32_t window, bool strict); - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; - - // Inherit doc from SearchIterator. - virtual void doSeek(uint32_t docId) override; + void visitMembers(vespalib::ObjectVisitor &visitor) const override; + void doSeek(uint32_t docId) override; }; /** @@ -97,9 +95,7 @@ private: }; std::vector<Matcher> _matchers; - - // Inherit doc from NearSearchBase. - virtual bool match(uint32_t docId) override; + bool match(uint32_t docId) override; public: /** @@ -131,9 +127,7 @@ private: }; std::vector<Matcher> _matchers; - - // Inherit doc from NearSearchBase. - virtual bool match(uint32_t docId) override; + bool match(uint32_t docId) override; public: /** diff --git a/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h b/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h index 5a62cc5dedb..b1fae7c0bb2 100644 --- a/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h @@ -2,8 +2,8 @@ #pragma once -#include <vespa/vespalib/objects/visit.h> #include "orsearch.h" +#include <vespa/vespalib/objects/visit.h> namespace search { namespace queryeval { @@ -52,16 +52,16 @@ public: _unpacker(unpacker) { } private: - virtual void onRemove(size_t index) override { + void onRemove(size_t index) override { _unpacker.onRemove(index); } - virtual void onInsert(size_t index) override { + void onInsert(size_t index) override { _unpacker.onInsert(index); } - virtual void doUnpack(uint32_t docid) override { + void doUnpack(uint32_t docid) override { _unpacker.unpack(docid, *this); } - virtual bool needUnpack(size_t index) const override { + bool needUnpack(size_t index) const override { return _unpacker.needUnpack(index); } Unpack _unpacker; @@ -70,4 +70,3 @@ private: } // namespace queryeval } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/orsearch.h b/searchlib/src/vespa/searchlib/queryeval/orsearch.h index e75776d7161..bd3d0aa5e3f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/orsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/orsearch.h @@ -27,9 +27,9 @@ public: protected: OrSearch(const Children & children) : MultiSearch(children) { } private: - virtual bool isOr() const override { return true; } + + bool isOr() const override { return true; } }; } // namespace queryeval } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h index 2d1f09da9c8..46765f40fd6 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h @@ -48,10 +48,9 @@ public: const fef::TermFieldMatchDataArray &childMatch, std::vector<uint32_t> eval_order, fef::TermFieldMatchData &tmd, bool strict); - - virtual void doSeek(uint32_t doc_id) override; - virtual void doUnpack(uint32_t doc_id) override; - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; + void doSeek(uint32_t doc_id) override; + void doUnpack(uint32_t doc_id) override; + void visitMembers(vespalib::ObjectVisitor &visitor) const override; SimplePhraseSearch & setDoom(const vespalib::Doom * doom) { _doom = doom; return *this; } }; diff --git a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h index 50553541e98..53c22deb237 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h @@ -23,8 +23,8 @@ private: SimpleSearch &operator=(const SimpleSearch &); protected: - virtual void doSeek(uint32_t docid) override; - virtual void doUnpack(uint32_t docid) override; + void doSeek(uint32_t docid) override; + void doUnpack(uint32_t docid) override; public: SimpleSearch(const SimpleResult &result); @@ -32,8 +32,8 @@ public: _tag = t; return *this; } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; - virtual ~SimpleSearch(); + void visitMembers(vespalib::ObjectVisitor &visitor) const override; + ~SimpleSearch(); }; } // namespace queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp index 07a7763d626..8aa015dc752 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp @@ -78,29 +78,28 @@ struct TermAsStringVisitor : public QueryVisitor { isSet = false; } - virtual void visit(And &) override { illegalVisit(); } - virtual void visit(AndNot &) override { illegalVisit(); } - virtual void visit(Equiv &) override { illegalVisit(); } - virtual void visit(Near &) override { illegalVisit(); } - virtual void visit(ONear &) override { illegalVisit(); } - virtual void visit(Or &) override { illegalVisit(); } - virtual void visit(Phrase &) override { illegalVisit(); } - virtual void visit(Rank &) override { illegalVisit(); } - virtual void visit(WeakAnd &) override { illegalVisit(); } - virtual void visit(WeightedSetTerm &) override { illegalVisit(); } - virtual void visit(DotProduct &) override { illegalVisit(); } - virtual void visit(WandTerm &) override { illegalVisit(); } - - virtual void visit(NumberTerm &n) override { visitTerm(n); } - virtual void visit(LocationTerm &n) override { visitTerm(n); } - virtual void visit(PrefixTerm &n) override { visitTerm(n); } - virtual void visit(RangeTerm &n) override { visitTerm(n); } - virtual void visit(StringTerm &n) override { visitTerm(n); } - virtual void visit(SubstringTerm &n) override { visitTerm(n); } - virtual void visit(SuffixTerm &n) override { visitTerm(n); } - virtual void visit(RegExpTerm &n) override { visitTerm(n); } - - virtual void visit(PredicateQuery &) override { illegalVisit(); } + void visit(And &) override {illegalVisit(); } + void visit(AndNot &) override {illegalVisit(); } + void visit(Equiv &) override {illegalVisit(); } + void visit(Near &) override {illegalVisit(); } + void visit(ONear &) override {illegalVisit(); } + void visit(Or &) override {illegalVisit(); } + void visit(Phrase &) override {illegalVisit(); } + void visit(Rank &) override {illegalVisit(); } + void visit(WeakAnd &) override {illegalVisit(); } + void visit(WeightedSetTerm &) override {illegalVisit(); } + void visit(DotProduct &) override {illegalVisit(); } + void visit(WandTerm &) override {illegalVisit(); } + + void visit(NumberTerm &n) override {visitTerm(n); } + void visit(LocationTerm &n) override {visitTerm(n); } + void visit(PrefixTerm &n) override {visitTerm(n); } + void visit(RangeTerm &n) override {visitTerm(n); } + void visit(StringTerm &n) override {visitTerm(n); } + void visit(SubstringTerm &n) override {visitTerm(n); } + void visit(SuffixTerm &n) override {visitTerm(n); } + void visit(RegExpTerm &n) override {visitTerm(n); } + void visit(PredicateQuery &) override {illegalVisit(); } }; } // namespace diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h index 1c3059913e8..3c1aba30bf7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h @@ -15,7 +15,7 @@ struct WeakAndSearch : SearchIterator { virtual wand::score_t get_max_score(size_t idx) const = 0; virtual const Terms &getTerms() const = 0; virtual uint32_t getN() const = 0; - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; + void visitMembers(vespalib::ObjectVisitor &visitor) const override; static SearchIterator *createArrayWand(const Terms &terms, uint32_t n, bool strict); static SearchIterator *createHeapWand(const Terms &terms, uint32_t n, bool strict); static SearchIterator *create(const Terms &terms, uint32_t n, bool strict); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp index c1f9baedb17..2b7b5398e1e 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp @@ -788,11 +788,8 @@ class FakeEGCompr64SkipFilterOcc : public FakeEGCompr64FilterOcc { public: FakeEGCompr64SkipFilterOcc(const FakeWord &fw); - - ~FakeEGCompr64SkipFilterOcc(void); - - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + ~FakeEGCompr64SkipFilterOcc(); + search::queryeval::SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h index fb49bd22cda..a2bd1ab1038 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h @@ -4,11 +4,9 @@ #include "fakeword.h" #include "fakeposting.h" -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { /* * Old compressed posocc format. @@ -40,70 +38,30 @@ private: void setup(const FakeWord &fw); template <bool bigEndian> - void - setupT(const FakeWord &fw); + void setupT(const FakeWord &fw); public: FakeEGCompr64FilterOcc(const FakeWord &fw); - - FakeEGCompr64FilterOcc(const FakeWord &fw, - bool bigEndian, - const char *nameSuffix); - - ~FakeEGCompr64FilterOcc(void); - - static void - forceLink(void); - - /* - * Size of posting list, in bits. - */ - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - /* - * Size of posting skip list, in bits. - */ - size_t skipBitSize(void) const override; - size_t l1SkipBitSize(void) const override; - size_t l2SkipBitSize(void) const override; - size_t l3SkipBitSize(void) const override; - size_t l4SkipBitSize(void) const override; - - /* - * Single posting list performance, without feature unpack. - */ - virtual int - lowLevelSinglePostingScan(void) const override; - - /* - * Single posting list performance, with feature unpack. - */ - virtual int - lowLevelSinglePostingScanUnpack(void) const override; - - /* - * Two posting lists performance (same format) without feature unpack. - */ - virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const override; - - /* - * Two posting lists performance (same format) with feature unpack. - */ - virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; - - - /* - * Iterator factory, for current query evaluation framework. - */ - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + FakeEGCompr64FilterOcc(const FakeWord &fw, bool bigEndian, const char *nameSuffix); + + ~FakeEGCompr64FilterOcc(); + + static void forceLink(); + + size_t bitSize() const override; + bool hasWordPositions() const override; + size_t skipBitSize() const override; + size_t l1SkipBitSize() const override; + size_t l2SkipBitSize() const override; + size_t l3SkipBitSize() const override; + size_t l4SkipBitSize() const override; + int lowLevelSinglePostingScan() const override; + int lowLevelSinglePostingScanUnpack() const override; + int lowLevelAndPairPostingScan(const FakePosting &rhs) const override; + int lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; + queryeval::SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata } // namespace search - diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h index 427110383fd..2946f15c539 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h @@ -4,11 +4,9 @@ #include "fakeword.h" #include "fakeposting.h" -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { /* * Old posocc format. @@ -22,51 +20,19 @@ private: public: FakeFilterOcc(const FakeWord &fakeword); - ~FakeFilterOcc(void); - - static void - forceLink(void); - - /* - * Size of posting list, in bits. - */ - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; + ~FakeFilterOcc(); - /* - * Single posting list performance, without feature unpack. - */ - virtual int - lowLevelSinglePostingScan(void) const override; + static void forceLink(); - /* - * Single posting list performance, with feature unpack. - */ - virtual int - lowLevelSinglePostingScanUnpack(void) const override; - - /* - * Two posting lists performance (same format) without feature unpack. - */ - virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const override; - - /* - * Two posting lists performance (same format) with feature unpack. - */ - virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; - - - /* - * Iterator factory, for current query evaluation framework. - */ - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + size_t bitSize() const override; + bool hasWordPositions(void) const override; + int lowLevelSinglePostingScan(void) const override; + int lowLevelSinglePostingScanUnpack(void) const override; + int lowLevelAndPairPostingScan(const FakePosting &rhs) const override; + int lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; + queryeval::SearchIterator * createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata } // namespace search - diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h index c4f3e27c4ac..acc28217d09 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h @@ -9,11 +9,8 @@ #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/searchlib/bitcompression/posocccompression.h> -namespace search -{ - -namespace fakedata -{ +namespace search { +namespace fakedata { class FakeMemTreeOccMgr : public FakeWord::RandomizedWriter { @@ -38,12 +35,9 @@ public: PostingIdx(NodeAllocator &allocator) : _tree(), _iterator(_tree.getRoot(), allocator) - { - } + {} - void - clear(void) - { + void clear() { _tree.clear(_iterator.getAllocator()); _iterator = _tree.begin(_iterator.getAllocator()); } @@ -64,8 +58,7 @@ public: _features(), _removal(true), _seq(0) - { - } + {} PendingOp(uint32_t wordIdx, uint32_t docId, EntryRef features) : _wordIdx(wordIdx), @@ -73,42 +66,15 @@ public: _features(features), _removal(false), _seq(0) - { - } + {} - void - setSeq(uint32_t seq) - { - _seq = seq; - } - - uint32_t - getWordIdx(void) const - { - return _wordIdx; - } - - uint32_t - getDocId(void) const - { - return _docId; - } + void setSeq(uint32_t seq) { _seq = seq; } + uint32_t getWordIdx(void) const { return _wordIdx; } + uint32_t getDocId(void) const { return _docId; } + EntryRef getFeatureRef(void) const { return _features; } + bool getRemove() const { return _removal; } - EntryRef - getFeatureRef(void) const - { - return _features; - } - - bool - getRemove(void) const - { - return _removal; - } - - bool - operator<(const PendingOp &rhs) const - { + bool operator<(const PendingOp &rhs) const { if (_wordIdx != rhs._wordIdx) return _wordIdx < rhs._wordIdx; if (_docId != rhs._docId) @@ -125,42 +91,19 @@ public: FeatureStore _featureStore; FakeMemTreeOccMgr(const Schema &schema); - - virtual - ~FakeMemTreeOccMgr(void); - - void - freeze(void); - - void - transferHoldLists(void); - - void - incGeneration(void); - - void - trimHoldLists(void); - - void - sync(void); - - virtual void - add(uint32_t wordIdx, index::DocIdAndFeatures &features) override; - - virtual void - remove(uint32_t wordIdx, uint32_t docId) override; - - void - sortUnflushed(void); - - void - flush(void); - - void - compactTrees(void); - - void - finalize(void); + ~FakeMemTreeOccMgr(); + + void freeze(); + void transferHoldLists(); + void incGeneration(); + void trimHoldLists(); + void sync(); + void add(uint32_t wordIdx, index::DocIdAndFeatures &features) override; + void remove(uint32_t wordIdx, uint32_t docId) override; + void sortUnflushed(); + void flush(); + void compactTrees(); + void finalize(); }; @@ -174,33 +117,22 @@ public: FakeMemTreeOccMgr _mgr; FakeMemTreeOccFactory(const Schema &schema); + ~FakeMemTreeOccFactory(); - virtual - ~FakeMemTreeOccFactory(void); - - virtual FakePosting::SP - make(const FakeWord &fw) override; - - virtual void - setup(const std::vector<const FakeWord *> &fws) override; + FakePosting::SP make(const FakeWord &fw) override; + void setup(const std::vector<const FakeWord *> &fws) override; }; class FakeMemTreeOcc2Factory : public FakeMemTreeOccFactory { public: FakeMemTreeOcc2Factory(const Schema &schema); + ~FakeMemTreeOcc2Factory(); - virtual - ~FakeMemTreeOcc2Factory(void); - - virtual FakePosting::SP - make(const FakeWord &fw) override; - - virtual void - setup(const std::vector<const FakeWord *> &fws) override; + FakePosting::SP make(const FakeWord &fw) override; + void setup(const std::vector<const FakeWord *> &fws) override; }; - /* * Updateable memory tree format. */ @@ -235,51 +167,18 @@ public: const FakeMemTreeOccMgr &mgr, const char *suffix); - ~FakeMemTreeOcc(void); - - static void - forceLink(void); - - /* - * Size of posting list, in bits. - */ - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - /* - * Single posting list performance, without feature unpack. - */ - virtual int - lowLevelSinglePostingScan(void) const override; + ~FakeMemTreeOcc(); - /* - * Single posting list performance, with feature unpack. - */ - virtual int - lowLevelSinglePostingScanUnpack(void) const override; - - /* - * Two posting lists performance (same format) without feature unpack. - */ - virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const override; - - /* - * Two posting lists performance (same format) with feature unpack. - */ - virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; - - - /* - * Iterator factory, for current query evaluation framework. - */ - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + static void forceLink(); + size_t bitSize() const override; + bool hasWordPositions() const override; + int lowLevelSinglePostingScan() const override; + int lowLevelSinglePostingScanUnpack() const override; + int lowLevelAndPairPostingScan(const FakePosting &rhs) const override; + int lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; + queryeval::SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata } // namespace search - diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h index 5e146b5705a..f88df381d92 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h @@ -4,11 +4,9 @@ #include "fakeword.h" #include "fakeposting.h" -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { /* * YST style compression of docid list. @@ -22,52 +20,19 @@ private: size_t _bitSize; public: FakeZcbFilterOcc(const FakeWord &fw); + ~FakeZcbFilterOcc(); - ~FakeZcbFilterOcc(void); - - static void - forceLink(void); - - /* - * Size of posting list, in bits. - */ - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - /* - * Single posting list performance, without feature unpack. - */ - virtual int - lowLevelSinglePostingScan(void) const override; + static void forceLink(); - /* - * Single posting list performance, with feature unpack. - */ - virtual int - lowLevelSinglePostingScanUnpack(void) const override; - - /* - * Two posting lists performance (same format) without feature unpack. - */ - virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const override; - - /* - * Two posting lists performance (same format) with feature unpack. - */ - virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; - - - /* - * Iterator factory, for current query evaluation framework. - */ - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + size_t bitSize() const override; + bool hasWordPositions() const override; + int lowLevelSinglePostingScan() const override; + int lowLevelSinglePostingScanUnpack() const override; + int lowLevelAndPairPostingScan(const FakePosting &rhs) const override; + int lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; + queryeval::SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata } // namespace search - diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp index dfd47889513..ee9bed6ba02 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp @@ -1,16 +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/log/log.h> -LOG_SETUP(".fakezcfilterocc"); #include "fakezcfilterocc.h" -#include <vespa/searchlib/bitcompression/compression.h> -#include <vespa/searchlib/bitcompression/posocccompression.h> -#include <vespa/searchlib/diskindex/zcposocciterators.h> -#include <vespa/searchlib/index/docidandfeatures.h> -#include <vespa/searchlib/index/postinglistcounts.h> #include "fpfactory.h" - +#include <vespa/searchlib/diskindex/zcposocciterators.h> using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; @@ -26,11 +18,9 @@ using search::bitcompression::FeatureEncodeContext; using search::ComprFileWriteContext; using namespace search::diskindex; -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { #define L1SKIPSTRIDE 16 @@ -769,10 +759,8 @@ class FakeZcSkipFilterOcc : public FakeZcFilterOcc public: FakeZcSkipFilterOcc(const FakeWord &fw); - ~FakeZcSkipFilterOcc(void); - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; + ~FakeZcSkipFilterOcc(); + SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; }; static FPFactoryInit @@ -1384,17 +1372,11 @@ class FakeEGCompr64PosOcc : public FakeZcFilterOcc { public: FakeEGCompr64PosOcc(const FakeWord &fw); - - ~FakeEGCompr64PosOcc(void); - + ~FakeEGCompr64PosOcc(); void setup(const FakeWord &fw); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; + size_t bitSize() const override; + bool hasWordPositions() const override; + SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; }; @@ -1488,7 +1470,7 @@ FakeEGCompr64PosOcc<bigEndian>::setup(const FakeWord &fw) template <bool bigEndian> size_t -FakeEGCompr64PosOcc<bigEndian>::bitSize(void) const +FakeEGCompr64PosOcc<bigEndian>::bitSize() const { return _compressedBits; } @@ -1496,7 +1478,7 @@ FakeEGCompr64PosOcc<bigEndian>::bitSize(void) const template <bool bigEndian> bool -FakeEGCompr64PosOcc<bigEndian>::hasWordPositions(void) const +FakeEGCompr64PosOcc<bigEndian>::hasWordPositions() const { return true; } @@ -1517,17 +1499,11 @@ class FakeEG2Compr64PosOcc : public FakeZcFilterOcc { public: FakeEG2Compr64PosOcc(const FakeWord &fw); - - ~FakeEG2Compr64PosOcc(void); - + ~FakeEG2Compr64PosOcc(); void setup(const FakeWord &fw); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + size_t bitSize() const override; + bool hasWordPositions() const override; + SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; @@ -1650,15 +1626,11 @@ class FakeZcSkipPosOcc : public FakeZcFilterOcc search::index::PostingListCounts _counts; public: FakeZcSkipPosOcc(const FakeWord &fw); + ~FakeZcSkipPosOcc(); - ~FakeZcSkipPosOcc(void); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; + size_t bitSize() const override; + bool hasWordPositions() const override; + SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; }; @@ -1673,14 +1645,14 @@ FakeZcSkipPosOcc<bigEndian>::FakeZcSkipPosOcc(const FakeWord &fw) template <bool bigEndian> -FakeZcSkipPosOcc<bigEndian>::~FakeZcSkipPosOcc(void) +FakeZcSkipPosOcc<bigEndian>::~FakeZcSkipPosOcc() { } template <bool bigEndian> size_t -FakeZcSkipPosOcc<bigEndian>::bitSize(void) const +FakeZcSkipPosOcc<bigEndian>::bitSize() const { return _compressedBits - _l1SkipSize - _l2SkipSize - _l3SkipSize - _l4SkipSize; @@ -1689,7 +1661,7 @@ FakeZcSkipPosOcc<bigEndian>::bitSize(void) const template <bool bigEndian> bool -FakeZcSkipPosOcc<bigEndian>::hasWordPositions(void) const +FakeZcSkipPosOcc<bigEndian>::hasWordPositions() const { return true; } @@ -1714,15 +1686,10 @@ class FakeZc2SkipPosOcc : public FakeZcFilterOcc search::index::PostingListCounts _counts; public: FakeZc2SkipPosOcc(const FakeWord &fw); - - ~FakeZc2SkipPosOcc(void); - - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const override; + ~FakeZc2SkipPosOcc(); + size_t bitSize() const override; + bool hasWordPositions() const override; + SearchIterator *createIterator(const TermFieldMatchDataArray &matchData) const override; }; @@ -1737,14 +1704,14 @@ FakeZc2SkipPosOcc<bigEndian>::FakeZc2SkipPosOcc(const FakeWord &fw) template <bool bigEndian> -FakeZc2SkipPosOcc<bigEndian>::~FakeZc2SkipPosOcc(void) +FakeZc2SkipPosOcc<bigEndian>::~FakeZc2SkipPosOcc() { } template <bool bigEndian> size_t -FakeZc2SkipPosOcc<bigEndian>::bitSize(void) const +FakeZc2SkipPosOcc<bigEndian>::bitSize() const { return _compressedBits - _l1SkipSize - _l2SkipSize - _l3SkipSize - _l4SkipSize; @@ -1753,7 +1720,7 @@ FakeZc2SkipPosOcc<bigEndian>::bitSize(void) const template <bool bigEndian> bool -FakeZc2SkipPosOcc<bigEndian>::hasWordPositions(void) const +FakeZc2SkipPosOcc<bigEndian>::hasWordPositions() const { return true; } diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h index 65ac3ead5d1..5d81e37001e 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h @@ -1,17 +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 "fakeword.h" #include "fakeposting.h" #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/searchlib/bitcompression/posocccompression.h> -namespace search -{ +namespace search { -namespace fakedata -{ +namespace fakedata { /* * YST style compression of docid list. @@ -38,70 +35,29 @@ protected: void setup(const FakeWord &fw, bool doFeatures, bool dynamicK); template <bool bigEndian> - void - setupT(const FakeWord &fw, bool doFeatures, bool dynamicK); + void setupT(const FakeWord &fw, bool doFeatures, bool dynamicK); public: FakeZcFilterOcc(const FakeWord &fw); - - FakeZcFilterOcc(const FakeWord &fw, - bool bigEndian, - const char *nameSuffix); - - ~FakeZcFilterOcc(void); - - static void - forceLink(void); - - /* - * Size of posting list, in bits. - */ - size_t bitSize(void) const override; - - virtual bool hasWordPositions(void) const override; - - /* - * Size of posting skip list, in bits. - */ - size_t skipBitSize(void) const override; - size_t l1SkipBitSize(void) const override; - size_t l2SkipBitSize(void) const override; - size_t l3SkipBitSize(void) const override; - size_t l4SkipBitSize(void) const override; - - /* - * Single posting list performance, without feature unpack. - */ - virtual int - lowLevelSinglePostingScan(void) const override; - - /* - * Single posting list performance, with feature unpack. - */ - virtual int - lowLevelSinglePostingScanUnpack(void) const override; - - /* - * Two posting lists performance (same format) without feature unpack. - */ - virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const override; - - /* - * Two posting lists performance (same format) with feature unpack. - */ - virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; - - - /* - * Iterator factory, for current query evaluation framework. - */ - virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const override; + FakeZcFilterOcc(const FakeWord &fw, bool bigEndian, const char *nameSuffix); + ~FakeZcFilterOcc(); + + static void forceLink(); + + size_t bitSize() const override; + bool hasWordPositions() const override; + size_t skipBitSize() const override; + size_t l1SkipBitSize() const override; + size_t l2SkipBitSize() const override; + size_t l3SkipBitSize() const override; + size_t l4SkipBitSize() const override; + int lowLevelSinglePostingScan() const override; + int lowLevelSinglePostingScanUnpack() const override; + int lowLevelAndPairPostingScan(const FakePosting &rhs) const override; + int lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; + queryeval::SearchIterator *createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata } // namespace search - diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h index bf02e815da8..aa67eb1b933 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h @@ -41,9 +41,7 @@ public: (void) schema; } - virtual FakePosting::SP - make(const FakeWord &fw) override - { + FakePosting::SP make(const FakeWord &fw) override { return FakePosting::SP(new P(fw)); } }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h index a41b6c27c5d..9eccdbaff0e 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h +++ b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h @@ -4,24 +4,16 @@ #include "syncproxy.h" -namespace search -{ -namespace transactionlog -{ +namespace search { +namespace transactionlog { class NoSyncProxy : public SyncProxy { public: - NoSyncProxy(void); - - virtual - ~NoSyncProxy(void); - - virtual void - sync(SerialNum syncTo) override; + NoSyncProxy(); + ~NoSyncProxy(); + void sync(SerialNum syncTo) override; }; } - } - diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h index e219f5cffbc..802933b7d81 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h @@ -66,10 +66,10 @@ public: Subscriber(const vespalib::string & domain, TransLogClient & tlc, Callback & callBack); bool subscribe(const SerialNum & from); - virtual ~Subscriber(); - virtual RPC::Result visit(const Packet & packet) override { return _callback.receive(packet); } - virtual void inSync() override { _callback.inSync(); } - virtual void eof() override { _callback.eof(); } + ~Subscriber(); + RPC::Result visit(const Packet & packet) override { return _callback.receive(packet); } + void inSync() override { _callback.inSync(); } + void eof() override { _callback.eof(); } private: Callback & _callback; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index 8e64b17ecb4..105a6ca643b 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -41,7 +41,7 @@ public: uint64_t setDomainPartSize(); DomainStats getDomainStats() const; - virtual void commit(const vespalib::string & domainName, const Packet & packet) override; + void commit(const vespalib::string & domainName, const Packet & packet) override; class Session @@ -56,8 +56,8 @@ public: }; private: - virtual bool onStop() override; - virtual void run() override; + bool onStop() override; + void run() override; void exportRPC(FRT_Supervisor & supervisor); void relayToThreadRPC(FRT_RPCRequest *req); diff --git a/searchlib/src/vespa/searchlib/util/rand48.h b/searchlib/src/vespa/searchlib/util/rand48.h index d8bfa683f15..6d27d179a74 100644 --- a/searchlib/src/vespa/searchlib/util/rand48.h +++ b/searchlib/src/vespa/searchlib/util/rand48.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Copyright (C) 2003 Fast Search & Transfer ASA -// Copyright (C) 2003 Overture Services Norway AS #pragma once +#include <cstdlib> +#include <cstdint> namespace search { @@ -26,14 +26,14 @@ public: { srand48(0x1234abcd); }; - void iterate(void) { + void iterate() { _state = (UINT64_C(0x5DEECE66D) * _state + 0xb) & UINT64_C(0xFFFFFFFFFFFF); } /* * Return value from 0 to 2^31 - 1 */ - long lrand48(void) { + long lrand48() { iterate(); return static_cast<long>(_state >> 17); } diff --git a/slobrok/src/apps/check_slobrok/check_slobrok.cpp b/slobrok/src/apps/check_slobrok/check_slobrok.cpp index 8e2a91c100d..9d588eab39f 100644 --- a/slobrok/src/apps/check_slobrok/check_slobrok.cpp +++ b/slobrok/src/apps/check_slobrok/check_slobrok.cpp @@ -1,14 +1,12 @@ // 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("check_slobrok"); #include <vespa/fnet/frt/frt.h> - +#include <vespa/fastos/app.h> #include <string> #include <sstream> +#include <vespa/log/log.h> +LOG_SETUP("check_slobrok"); class Slobrok_Checker : public FastOS_Application { @@ -25,10 +23,9 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main() override; + int Main() override; }; - Slobrok_Checker::~Slobrok_Checker() { LOG_ASSERT(_supervisor == NULL); diff --git a/slobrok/src/apps/sbcmd/sbcmd.cpp b/slobrok/src/apps/sbcmd/sbcmd.cpp index 60a3dfc779b..a96c4609137 100644 --- a/slobrok/src/apps/sbcmd/sbcmd.cpp +++ b/slobrok/src/apps/sbcmd/sbcmd.cpp @@ -1,14 +1,12 @@ // 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("sb-cmd"); #include <vespa/fnet/frt/frt.h> - +#include <vespa/fastos/app.h> #include <string> #include <sstream> +#include <vespa/log/log.h> +LOG_SETUP("sb-cmd"); class Slobrok_CMD : public FastOS_Application { @@ -25,17 +23,15 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main() override; + int Main() override; }; - Slobrok_CMD::~Slobrok_CMD() { LOG_ASSERT(_supervisor == NULL); LOG_ASSERT(_target == NULL); } - int Slobrok_CMD::usage() { diff --git a/slobrok/src/tests/mirrorapi/match_test.cpp b/slobrok/src/tests/mirrorapi/match_test.cpp index d9ebcfd6f29..94900daa202 100644 --- a/slobrok/src/tests/mirrorapi/match_test.cpp +++ b/slobrok/src/tests/mirrorapi/match_test.cpp @@ -4,12 +4,11 @@ class MatchTester : public slobrok::api::IMirrorAPI { - virtual SpecList lookup(const std::string &) const override { + SpecList lookup(const std::string &) const override { return SpecList(); } - virtual uint32_t updates() const override { return 0; } - - virtual bool ready() const override { return true; } + uint32_t updates() const override { return 0; } + bool ready() const override { return true; } const std::string name; diff --git a/slobrok/src/tests/oldapi/mirror.h b/slobrok/src/tests/oldapi/mirror.h index 1f0db564cae..b83392dec5e 100644 --- a/slobrok/src/tests/oldapi/mirror.h +++ b/slobrok/src/tests/oldapi/mirror.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#ifndef Old_MIRROR_H -#define Old_MIRROR_H +#pragma once #include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/gencnt.h> @@ -86,10 +85,7 @@ public: **/ ~MirrorOld(); - // Inherit doc from IMirrorOld. SpecList lookup(const std::string & pattern) const override; - - // Inherit doc from IMirrorOld. uint32_t updates() const override { return _updates.getAsInt(); } /** @@ -110,10 +106,7 @@ private: MirrorOld(const MirrorOld &); MirrorOld &operator=(const MirrorOld &); - /** from FNET_Task, polls slobrok **/ void PerformTask() override; - - /** from FRT_IRequestWait **/ void RequestDone(FRT_RPCRequest *req) override; FRT_Supervisor &_orb; @@ -131,5 +124,3 @@ private: } // namespace api } // namespace slobrok - -#endif diff --git a/slobrok/src/tests/startsome/rpc_info.cpp b/slobrok/src/tests/startsome/rpc_info.cpp index 76b578d4f88..be5418ff1a8 100644 --- a/slobrok/src/tests/startsome/rpc_info.cpp +++ b/slobrok/src/tests/startsome/rpc_info.cpp @@ -1,8 +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/log/log.h> -LOG_SETUP("rpc_info"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCInfo : public FastOS_Application { diff --git a/slobrok/src/tests/startsome/tstdst.cpp b/slobrok/src/tests/startsome/tstdst.cpp index e2f6ae070b3..7d3fcef8695 100644 --- a/slobrok/src/tests/startsome/tstdst.cpp +++ b/slobrok/src/tests/startsome/tstdst.cpp @@ -1,15 +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("testrpcserver"); #include <vespa/vespalib/util/host_name.h> -#include <vespa/fnet/fnet.h> #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> -#include <vector> -#include <string> -#include <sstream> +#include <vespa/log/log.h> +LOG_SETUP("testrpcserver"); class FNET_Transport; class FNET_Scheduler; diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index ce21c918219..75092255f9e 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -1,5 +1,4 @@ // 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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/optimized.h> diff --git a/staging_vespalib/src/tests/array/allocinarray_test.cpp b/staging_vespalib/src/tests/array/allocinarray_test.cpp index 059fff91cec..c68cc3fa874 100644 --- a/staging_vespalib/src/tests/array/allocinarray_test.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_test.cpp @@ -1,14 +1,10 @@ // 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> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/allocinarray.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> #include <deque> -LOG_SETUP("array_test"); - using namespace vespalib; class Test : public TestApp diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index 9e2b286e864..29f1560e426 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -1,5 +1,4 @@ // 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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/array.hpp> diff --git a/staging_vespalib/src/tests/benchmark/testbase.h b/staging_vespalib/src/tests/benchmark/testbase.h index 02f11e21cac..beb485e6dab 100644 --- a/staging_vespalib/src/tests/benchmark/testbase.h +++ b/staging_vespalib/src/tests/benchmark/testbase.h @@ -45,7 +45,7 @@ public: private: typedef std::vector<int> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByValueVectorInt : public Benchmark @@ -55,7 +55,7 @@ public: private: typedef std::vector<int> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByReferenceVectorString : public Benchmark @@ -65,7 +65,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ParamByValueVectorString : public Benchmark @@ -75,7 +75,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByReferenceVectorString : public Benchmark @@ -85,7 +85,7 @@ public: private: typedef std::vector<std::string> Vector; const Vector & returnByReference(Vector & values) const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByValueVectorString : public Benchmark @@ -95,7 +95,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class ReturnByValueMultiVectorString : public Benchmark @@ -105,7 +105,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun() override; + size_t onRun() override; }; class CreateVespalibString : public Benchmark @@ -113,7 +113,7 @@ class CreateVespalibString : public Benchmark public: DECLARE_BENCHMARK(CreateVespalibString); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockSystem : public Benchmark @@ -121,7 +121,7 @@ class ClockSystem : public Benchmark public: DECLARE_BENCHMARK(ClockSystem); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockREALTIME : public Benchmark @@ -129,7 +129,7 @@ class ClockREALTIME : public Benchmark public: DECLARE_BENCHMARK(ClockREALTIME); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockMONOTONIC : public Benchmark @@ -137,7 +137,7 @@ class ClockMONOTONIC : public Benchmark public: DECLARE_BENCHMARK(ClockMONOTONIC); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockMONOTONIC_RAW : public Benchmark @@ -146,7 +146,7 @@ public: DECLARE_BENCHMARK(ClockMONOTONIC_RAW); ClockMONOTONIC_RAW(); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockPROCESS_CPUTIME_ID : public Benchmark @@ -154,7 +154,7 @@ class ClockPROCESS_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockPROCESS_CPUTIME_ID); private: - virtual size_t onRun() override; + size_t onRun() override; }; class ClockTHREAD_CPUTIME_ID : public Benchmark @@ -162,8 +162,7 @@ class ClockTHREAD_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockTHREAD_CPUTIME_ID); private: - virtual size_t onRun() override; + size_t onRun() override; }; } - diff --git a/staging_vespalib/src/tests/bits/bits_test.cpp b/staging_vespalib/src/tests/bits/bits_test.cpp index f7b3ef1bf84..783651db366 100644 --- a/staging_vespalib/src/tests/bits/bits_test.cpp +++ b/staging_vespalib/src/tests/bits/bits_test.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("bits_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/bits.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp index 025d8766a29..58a01a520b6 100644 --- a/staging_vespalib/src/tests/clock/clock_test.cpp +++ b/staging_vespalib/src/tests/clock/clock_test.cpp @@ -1,9 +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/log/log.h> -LOG_SETUP("sharedptr_test"); -#include <vespa/vespalib/util/clock.h> + #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/clock.h> using vespalib::Clock; using fastos::TimeStamp; diff --git a/staging_vespalib/src/tests/crc/crc_test.cpp b/staging_vespalib/src/tests/crc/crc_test.cpp index 6a5a0779d8b..df8ac89db62 100644 --- a/staging_vespalib/src/tests/crc/crc_test.cpp +++ b/staging_vespalib/src/tests/crc/crc_test.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("crc_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/crc.h> #include <boost/crc.hpp> diff --git a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp index 7ec83e58b5c..1a242e8eec4 100644 --- a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp +++ b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp @@ -1,7 +1,4 @@ // 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("databuffer_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/databuffer.h> diff --git a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp index f2a6c8402ee..55ca571cdac 100644 --- a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp +++ b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp @@ -1,10 +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/log/log.h> -LOG_SETUP("fileheader_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/fileheader.h> +#include <vespa/fastos/file.h> #include <iostream> using namespace vespalib; @@ -29,15 +27,9 @@ private: void testRewriteErrors(); void testLayout(); - void - testReadSize(bool mapped); - - void - testReadSizeErrors(bool mapped); - - bool - testReadSizeError(DataBuffer &buf, const std::string &expected, - bool mapped); + void testReadSize(bool mapped); + void testReadSizeErrors(bool mapped); + bool testReadSizeError(DataBuffer &buf, const std::string &expected, bool mapped); public: int Main() override { diff --git a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp index 98b6804ac8e..19e52dbe885 100644 --- a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp +++ b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - // Include first to make sure it includes all it need. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/objects/floatingpointtype.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/objects/floatingpointtype.h> class Test : public vespalib::TestApp { diff --git a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp index aaf3f383c33..1ba9c912344 100644 --- a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp +++ b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("guard_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/growablebytebuffer.h> diff --git a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp index 665dbca8a86..87e04d3ffbd 100644 --- a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp +++ b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp @@ -1,10 +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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/librarypool.h> #include <vespa/vespalib/util/exceptions.h> -#include <vespa/log/log.h> -LOG_SETUP("librarypool_test"); using namespace vespalib; diff --git a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp index 5430e8c1465..5a1c0d7fb32 100644 --- a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp +++ b/staging_vespalib/src/tests/memorydatastore/memorydatastore.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/log/log.h> -LOG_SETUP("data_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/memorydatastore.h> #include <vespa/vespalib/stllike/asciistream.h> -#include <vector> using namespace vespalib; diff --git a/staging_vespalib/src/tests/objectdump/objectdump.cpp b/staging_vespalib/src/tests/objectdump/objectdump.cpp index 671e89b5011..3bdbe2401e4 100644 --- a/staging_vespalib/src/tests/objectdump/objectdump.cpp +++ b/staging_vespalib/src/tests/objectdump/objectdump.cpp @@ -1,5 +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 <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.h> #include <vespa/vespalib/objects/visit.hpp> @@ -22,7 +22,7 @@ IMPLEMENT_IDENTIFIABLE(Base, vespalib::Identifiable); struct Baz : public Base { DECLARE_IDENTIFIABLE(Baz); - virtual Baz *clone() const override { return new Baz(*this); } + Baz *clone() const override { return new Baz(*this); } }; IMPLEMENT_IDENTIFIABLE(Baz, Base); @@ -45,9 +45,9 @@ struct Bar : public Base _int32(-4), _uint32(4), _int64(-8), _uint64(8), _float(2.5), _double(2.75), _string("bla bla") {} - virtual Bar *clone() const override { return new Bar(*this); } + Bar *clone() const override { return new Bar(*this); } - virtual void visitMembers(ObjectVisitor &v) const override { + void visitMembers(ObjectVisitor &v) const override { visit(v, "_bool", _bool); visit(v, "_int8", _int8); visit(v, "_uint8", _uint8); diff --git a/staging_vespalib/src/tests/objects/identifiable_test.cpp b/staging_vespalib/src/tests/objects/identifiable_test.cpp index c60f33b9b55..5ef48b6e779 100644 --- a/staging_vespalib/src/tests/objects/identifiable_test.cpp +++ b/staging_vespalib/src/tests/objects/identifiable_test.cpp @@ -1,5 +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 <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/namedobject.h> @@ -40,7 +40,7 @@ class A : public Abstract public: DECLARE_IDENTIFIABLE(A); A() { } - virtual void someAbstractVirtualMethod() override { } + void someAbstractVirtualMethod() override { }; }; class B : public A diff --git a/staging_vespalib/src/tests/objectselection/objectselection.cpp b/staging_vespalib/src/tests/objectselection/objectselection.cpp index 27ecb068231..db696230082 100644 --- a/staging_vespalib/src/tests/objectselection/objectselection.cpp +++ b/staging_vespalib/src/tests/objectselection/objectselection.cpp @@ -1,5 +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 <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/objects/identifiable.hpp> #include <vespa/vespalib/objects/objectpredicate.h> @@ -17,7 +17,7 @@ struct Foo : public Identifiable DECLARE_IDENTIFIABLE(Foo); virtual Foo *clone() const { return new Foo(*this); } - virtual void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { + void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { for (uint32_t i = 0; i < nodes.size(); ++i) { nodes[i]->select(p, o); } @@ -32,7 +32,7 @@ struct Bar : public Foo DECLARE_IDENTIFIABLE(Bar); Bar() : value(0) {} Bar(int v) { value = v; } - virtual Bar *clone() const override { return new Bar(*this); } + Bar *clone() const override { return new Bar(*this); } }; IMPLEMENT_IDENTIFIABLE(Bar, Identifiable); @@ -40,7 +40,7 @@ struct ObjectType : public ObjectPredicate { uint32_t cid; ObjectType(uint32_t id) : cid(id) {} - virtual bool check(const Identifiable &obj) const override { + bool check(const Identifiable &obj) const override { return (obj.getClass().id() == cid); } }; @@ -48,7 +48,7 @@ struct ObjectType : public ObjectPredicate struct ObjectCollect : public ObjectOperation { std::vector<Identifiable*> nodes; - virtual void execute(Identifiable &obj) override { + void execute(Identifiable &obj) override { nodes.push_back(&obj); } }; diff --git a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp index affb7287674..a1c8a31729c 100644 --- a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp +++ b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp @@ -1,5 +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 <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/polymorphicarrays.h> @@ -112,7 +112,7 @@ class Factory : public ComplexArrayT<A>::Factory { public: A * create() override { return new Complex(); } - virtual Factory * clone() const override { return new Factory(*this); } + Factory * clone() const override { return new Factory(*this); } }; TEST("require that complex arrays conforms") { diff --git a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp index 881954bfa3f..709f8a3b723 100644 --- a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp +++ b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp @@ -1,14 +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/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vespalib/util/programoptions_testutils.h> - #include <iostream> -#include <vespa/log/log.h> -#include <vespa/vespalib/testkit/testapp.h> - -LOG_SETUP("programoptions_test"); namespace vespalib { diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 0367ab8c374..5094bd8b5c9 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -1,8 +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 <stddef.h> -#include <vespa/log/log.h> -LOG_SETUP("alloc_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp index f572dbcd8e1..e15a3826669 100644 --- a/staging_vespalib/src/tests/state_server/state_server_test.cpp +++ b/staging_vespalib/src/tests/state_server/state_server_test.cpp @@ -1,5 +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 <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/net/state_server.h> #include <vespa/vespalib/net/simple_health_producer.h> @@ -52,10 +52,8 @@ vespalib::string getFull(int port, const vespalib::string &path) { return getPag struct DummyHandler : JsonGetHandler { vespalib::string result; DummyHandler(const vespalib::string &result_in) : result(result_in) {} - virtual vespalib::string get(const vespalib::string &, - const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) - const override + vespalib::string get(const vespalib::string &, const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) const override { return result; } @@ -113,10 +111,8 @@ TEST_FFFF("require that handler is selected based on longest matching url prefix } struct EchoHost : JsonGetHandler { - virtual vespalib::string get(const vespalib::string &host, - const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) - const override + vespalib::string get(const vespalib::string &host, const vespalib::string &, + const std::map<vespalib::string,vespalib::string> &) const override { return "[\"" + host + "\"]"; } @@ -316,11 +312,11 @@ TEST_FFFFF("require that custom handlers can be added to the state server", } struct EchoConsumer : MetricsProducer { - virtual vespalib::string getMetrics(const vespalib::string &consumer) override { + vespalib::string getMetrics(const vespalib::string &consumer) override { return "[\"" + consumer + "\"]"; } - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override { - return "[\"" + consumer + "\"]"; + vespalib::string getTotalMetrics(const vespalib::string &consumer) override { + return "[\"" + consumer + "\"]"; } }; diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp index ad782f4089f..21b60b828cc 100644 --- a/staging_vespalib/src/tests/timer/timer_test.cpp +++ b/staging_vespalib/src/tests/timer/timer_test.cpp @@ -1,7 +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 <vespa/log/log.h> -LOG_SETUP("timer_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/timer.h> #include <vespa/vespalib/util/executor.h> diff --git a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp index 1035c021f68..90fcdb8f94f 100644 --- a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp +++ b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp @@ -1,9 +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/vespalib/util/xmlserializable.h> - #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/xmlserializable.h> namespace vespalib { diff --git a/staging_vespalib/src/vespa/vespalib/util/programoptions.h b/staging_vespalib/src/vespa/vespalib/util/programoptions.h index 58d1d133d04..9e25f960af7 100644 --- a/staging_vespalib/src/vespa/vespalib/util/programoptions.h +++ b/staging_vespalib/src/vespa/vespalib/util/programoptions.h @@ -23,12 +23,10 @@ #pragma once +#include <vespa/vespalib/util/exception.h> #include <map> #include <set> -#include <string> #include <vector> -#include <stdint.h> -#include <vespa/vespalib/util/exception.h> namespace vespalib { @@ -237,9 +235,9 @@ struct ProgramOptions::OptionParser { struct ProgramOptions::OptionHeader : public OptionParser { OptionHeader(const std::string& desc) : OptionParser("", 0, desc) {} - virtual void set(const std::vector<std::string>&) override {} - virtual void setDefault() override {} - virtual bool isHeader() const override { return true; } + void set(const std::vector<std::string>&) override {} + void setDefault() override {} + bool isHeader() const override { return true; } }; template<typename Number> @@ -262,61 +260,45 @@ struct ProgramOptions::NumberOptionParser : public OptionParser { : OptionParser(nameList, 1, getStringValue(defValue), desc), _number(number), _defaultValue(defValue) - { - } - - virtual void set(const std::vector<std::string>& arguments) override; - - virtual void setDefault() override { _number = _defaultValue; } - - virtual std::string getArgType(uint32_t /* index */) const override - { return getTypeName<Number>(); } + {} + void set(const std::vector<std::string>& arguments) override; + void setDefault() override { _number = _defaultValue; } + std::string getArgType(uint32_t /* index */) const override { + return getTypeName<Number>(); + } }; struct ProgramOptions::BoolOptionParser : public OptionParser { bool& _value; bool _defaultValue; - BoolOptionParser(const std::string& nameList, bool& value, - const std::string& description); - - virtual void set(const std::vector<std::string>&) override { _value = true; } - - virtual void setDefault() override { _value = false; } + BoolOptionParser(const std::string& nameList, bool& value, const std::string& description); + void set(const std::vector<std::string>&) override { _value = true; } + void setDefault() override { _value = false; } }; struct ProgramOptions::FlagOptionParser : public OptionParser { bool& _value; bool _unsetValue; - FlagOptionParser(const std::string& nameList, bool& value, - const std::string& description); - FlagOptionParser(const std::string& nameList, bool& value, - const bool& unsetValue, const std::string& description); - - virtual void set(const std::vector<std::string>&) override { _value = !_unsetValue; } - - virtual void setDefault() override { _value = _unsetValue; } + FlagOptionParser(const std::string& nameList, bool& value, const std::string& description); + FlagOptionParser(const std::string& nameList, bool& value, const bool& unsetValue, const std::string& description); + void set(const std::vector<std::string>&) override { _value = !_unsetValue; } + void setDefault() override { _value = _unsetValue; } }; struct ProgramOptions::StringOptionParser : public OptionParser { std::string& _value; std::string _defaultValue; - StringOptionParser(const std::string& nameList, std::string& value, - const std::string& description); - + StringOptionParser(const std::string& nameList, std::string& value, const std::string& description); StringOptionParser(const std::string& nameList, std::string& value, const std::string& defVal, const std::string& desc); - virtual void set(const std::vector<std::string>& arguments) override - { _value = arguments[0]; } - - virtual void setDefault() override { _value = _defaultValue; } - - virtual std::string getArgType(uint32_t /* index */) const override - { return "string"; } + void set(const std::vector<std::string>& arguments) override { _value = arguments[0]; } + void setDefault() override { _value = _defaultValue; } + std::string getArgType(uint32_t /* index */) const override { return "string"; } }; struct ProgramOptions::MapOptionParser : public OptionParser { @@ -327,14 +309,14 @@ struct ProgramOptions::MapOptionParser : public OptionParser { std::map<std::string, std::string>& value, const std::string& description); - virtual void set(const std::vector<std::string>& arguments) override - { _value[arguments[0]] = arguments[1]; } + void set(const std::vector<std::string>& arguments) override { + _value[arguments[0]] = arguments[1]; + } - virtual std::string getArgType(uint32_t /* index */) const override - { return "string"; } + std::string getArgType(uint32_t /* index */) const override { return "string"; } - // Default of map is just an empty map. - virtual void setDefault() override { _value.clear(); } + // Default of map is just an empty map. + void setDefault() override { _value.clear(); } }; template<typename T> @@ -356,9 +338,8 @@ struct ProgramOptions::ListOptionParser : public OptionParser { void setEntryParser(OptionParser::UP entryParser) { _entryParser = std::move(entryParser); } - - virtual bool isRequired() const override { return false; } - virtual void set(const std::vector<std::string>& arguments) override { + bool isRequired() const override { return false; } + void set(const std::vector<std::string>& arguments) override { for (uint32_t i=0; i<arguments.size(); ++i) { std::vector<std::string> v; v.push_back(arguments[i]); @@ -366,10 +347,10 @@ struct ProgramOptions::ListOptionParser : public OptionParser { _value.push_back(_singleValue); } } - virtual void setDefault() override { + void setDefault() override { _value.clear(); } - virtual std::string getArgType(uint32_t index) const override { + std::string getArgType(uint32_t index) const override { return _entryParser->getArgType(index) + "[]"; } }; diff --git a/storage/src/tests/bucketdb/initializertest.cpp b/storage/src/tests/bucketdb/initializertest.cpp index 9aa7da92e36..47e80f0c202 100644 --- a/storage/src/tests/bucketdb/initializertest.cpp +++ b/storage/src/tests/bucketdb/initializertest.cpp @@ -423,7 +423,8 @@ struct FakePersistenceLayer : public StorageLink { } return 0; } - virtual bool onDown(const api::StorageMessage::SP& msg) override { + + bool onDown(const api::StorageMessage::SP& msg) override { fatalError = ""; if (messageCallback) { messageCallback->onMessage(*msg); diff --git a/storage/src/tests/bucketmover/bucketmovertest.cpp b/storage/src/tests/bucketmover/bucketmovertest.cpp index 3a844b6d1d8..c233765ad27 100644 --- a/storage/src/tests/bucketmover/bucketmovertest.cpp +++ b/storage/src/tests/bucketmover/bucketmovertest.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 <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/bucketmover/bucketmover.h> diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index 8dea2fad94f..15f0373e680 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -67,10 +67,8 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const override - { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const override - { return _clock.getTimeInMillis().getTime(); } + time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } + time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/distributor/blockingoperationstartertest.cpp b/storage/src/tests/distributor/blockingoperationstartertest.cpp index 2ae8a819d7e..64f3dae8fbe 100644 --- a/storage/src/tests/distributor/blockingoperationstartertest.cpp +++ b/storage/src/tests/distributor/blockingoperationstartertest.cpp @@ -1,9 +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 <vespa/vdstestlib/cppunit/macros.h> -#include <string> -#include <sstream> -#include <memory> #include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/distributor/blockingoperationstarter.h> #include <vespa/storage/distributor/pendingmessagetracker.h> diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index 13a8aff239c..5d1bb17a1c6 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -1,9 +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 <tests/distributor/bucketdatabasetest.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> -#include <iostream> -#include <fstream> #include <iomanip> namespace storage { diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index 7ad083dc5a1..e35f147d0c8 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -13,7 +13,6 @@ #include <iostream> #include <fstream> -#include <string> using namespace storage::api; using namespace storage::lib; diff --git a/storage/src/tests/distributor/bucketstateoperationtest.cpp b/storage/src/tests/distributor/bucketstateoperationtest.cpp index 74a31de1541..58061def8ab 100644 --- a/storage/src/tests/distributor/bucketstateoperationtest.cpp +++ b/storage/src/tests/distributor/bucketstateoperationtest.cpp @@ -28,13 +28,10 @@ private: void testBucketDbNotUpdatedOnFailure(); public: - void setUp() override - { + void setUp() override { createLinks(); } - - void tearDown() override - { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp index e7078f08d0a..3e4e1d6da88 100644 --- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp +++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp @@ -6,7 +6,6 @@ #include <vespa/storage/distributor/min_replica_provider.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/io/fileutil.h> -#include <vespa/vespalib/util/jsonstream.h> #include <vespa/vespalib/testkit/test_kit.h> #include <tests/common/hostreporter/util.h> #include <vespa/vespalib/stllike/asciistream.h> diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp index fc09dc17c1f..10b0d035770 100644 --- a/storage/src/tests/distributor/distributortest.cpp +++ b/storage/src/tests/distributor/distributortest.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iomanip> -#include <iostream> -#include <memory> #include <boost/assign/std/vector.hpp> // for 'operator+=()' #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storage/distributor/idealstatemetricsset.h> diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp index 2b861d23c5e..e4fce6b9d6e 100644 --- a/storage/src/tests/distributor/idealstatemanagertest.cpp +++ b/storage/src/tests/distributor/idealstatemanagertest.cpp @@ -11,7 +11,6 @@ #include <tests/distributor/distributortestutil.h> - namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/mapbucketdatabasetest.cpp b/storage/src/tests/distributor/mapbucketdatabasetest.cpp index 6892f522bba..8af2a86e4c5 100644 --- a/storage/src/tests/distributor/mapbucketdatabasetest.cpp +++ b/storage/src/tests/distributor/mapbucketdatabasetest.cpp @@ -1,10 +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 <vespa/vespalib/util/document_runnable.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <cppunit/extensions/HelperMacros.h> #include <vespa/storage/bucketdb/mapbucketdatabase.h> -#include <vespa/storage/storageutil/utils.h> #include <tests/distributor/bucketdatabasetest.h> namespace storage { @@ -12,8 +8,7 @@ namespace distributor { struct MapBucketDatabaseTest : public BucketDatabaseTest { MapBucketDatabase _db; - - virtual BucketDatabase& db() override { return _db; } + BucketDatabase& db() override { return _db; }; CPPUNIT_TEST_SUITE(MapBucketDatabaseTest); SETUP_DATABASE_TESTS(); diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index 875d16a42ed..1e317e20b74 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -1,5 +1,4 @@ // 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 <boost/lexical_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <iomanip> diff --git a/storage/src/tests/distributor/messagesenderstub.h b/storage/src/tests/distributor/messagesenderstub.h index 7b552ec6883..629c1c6e346 100644 --- a/storage/src/tests/distributor/messagesenderstub.h +++ b/storage/src/tests/distributor/messagesenderstub.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/storage/distributor/distributormessagesender.h> +#include <cassert> namespace storage { @@ -20,13 +21,11 @@ struct MessageSenderStub : distributor::DistributorMessageSender replies.clear(); } - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) - { + virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) { commands.push_back(cmd); } - virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) - { + virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) { replies.push_back(reply); } @@ -67,4 +66,3 @@ private: }; } - diff --git a/storage/src/tests/distributor/operationtargetresolvertest.cpp b/storage/src/tests/distributor/operationtargetresolvertest.cpp index 26144ac950e..d0dc8cedaf3 100644 --- a/storage/src/tests/distributor/operationtargetresolvertest.cpp +++ b/storage/src/tests/distributor/operationtargetresolvertest.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iomanip> -#include <iostream> #include <vespa/config/helper/configgetter.h> #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/repo/documenttyperepo.h> diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp index 6f4539d426e..618d7980c5b 100644 --- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp +++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp @@ -1,5 +1,4 @@ // 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/document/base/testdocman.h> #include <vespa/storage/distributor/pendingmessagetracker.h> @@ -10,13 +9,6 @@ #include <tests/common/dummystoragelink.h> #include <vespa/vdslib/state/random.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <fstream> -#include <sstream> -#include <iomanip> -#include <iostream> -#include <memory> -#include <string> -#include <iterator> namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp index 100d5582006..342d346b398 100644 --- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp +++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp @@ -1,18 +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/vdstestlib/cppunit/macros.h> #include <vespa/storage/distributor/maintenance/simplemaintenancescanner.h> #include <vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h> #include <vespa/storage/bucketdb/mapbucketdatabase.h> #include <tests/distributor/maintenancemocks.h> -#include <string> -#include <sstream> -#include <memory> -#include <algorithm> -#include <iterator> - namespace storage { namespace distributor { diff --git a/storage/src/tests/distributor/statusreporterdelegatetest.cpp b/storage/src/tests/distributor/statusreporterdelegatetest.cpp index f136b00244a..d9f647a52a5 100644 --- a/storage/src/tests/distributor/statusreporterdelegatetest.cpp +++ b/storage/src/tests/distributor/statusreporterdelegatetest.cpp @@ -1,5 +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 <vespa/vdstestlib/cppunit/macros.h> #include <tests/common/testhelper.h> #include <tests/distributor/distributortestutil.h> diff --git a/storage/src/tests/distributor/throttlingoperationstartertest.cpp b/storage/src/tests/distributor/throttlingoperationstartertest.cpp index 8e7d98005c1..0414ad11da4 100644 --- a/storage/src/tests/distributor/throttlingoperationstartertest.cpp +++ b/storage/src/tests/distributor/throttlingoperationstartertest.cpp @@ -1,9 +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 <vespa/vdstestlib/cppunit/macros.h> -#include <string> -#include <sstream> -#include <memory> #include <vespa/storage/distributor/throttlingoperationstarter.h> #include <tests/distributor/maintenancemocks.h> diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index 567f9192d34..43d13acb28b 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.cpp @@ -1,16 +1,12 @@ // 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/document/util/stringutil.h> -#include <vespa/log/log.h> -#include <sstream> #include <vespa/storageframework/defaultimplementation/component/componentregisterimpl.h> #include <vespa/storage/frameworkimpl/status/statuswebserver.h> #include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h> #include <tests/common/teststorageapp.h> #include <vespa/vdstestlib/cppunit/macros.h> - -LOG_SETUP(".test.status"); +#include <vespa/document/util/stringutil.h> +#include <sstream> namespace storage { @@ -47,18 +43,13 @@ namespace { : framework::HtmlStatusReporter(id, name), _headerAddition(headerAddition), _content(content) - { - } + {} - virtual void reportHtmlHeaderAdditions( - std::ostream& out, const framework::HttpUrlPath&) const override - { + void reportHtmlHeaderAdditions(std::ostream& out, const framework::HttpUrlPath&) const override { out << _headerAddition; } - virtual void reportHtmlStatus( - std::ostream& out, const framework::HttpUrlPath&) const override - { + void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override { out << _content; } }; @@ -66,9 +57,9 @@ namespace { struct XmlStatusReporter : public framework::XmlStatusReporter { XmlStatusReporter(const std::string& id, const std::string& name) : framework::XmlStatusReporter(id, name) {} - virtual vespalib::string reportXmlStatus( - vespalib::xml::XmlOutputStream& xos, - const framework::HttpUrlPath&) const override + + vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream& xos, + const framework::HttpUrlPath&) const override { xos << vespalib::xml::XmlTag("mytag") << vespalib::xml::XmlAttribute("foo", "bar") diff --git a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp index 8553795db71..5f675c1d551 100644 --- a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp +++ b/storage/src/tests/persistence/bucketownershipnotifiertest.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 <vespa/vdstestlib/cppunit/macros.h> #include <tests/distributor/messagesenderstub.h> #include <tests/common/teststorageapp.h> diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index e21d367370b..e2f41aa5b3e 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -9,7 +9,6 @@ #include <vespa/document/select/parser.h> #include <vespa/vdslib/state/random.h> #include <vespa/vdslib/container/mutabledocumentlist.h> -#include <vespa/vdslib/container/operationlist.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/storageapi/message/bucket.h> @@ -18,25 +17,17 @@ #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/removelocation.h> #include <vespa/storage/bucketdb/bucketmanager.h> -#include <vespa/storage/bucketdb/storbucketdb.h> -#include <vespa/storage/common/bucketmessages.h> -#include <vespa/storageframework/storageframework.h> #include <vespa/storage/persistence/persistencethread.h> -#include <vespa/storage/persistence/messages.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> #include <tests/common/teststorageapp.h> -#include <tests/common/dummystoragelink.h> #include <tests/persistence/filestorage/forwardingmessagesender.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <vespa/storageapi/message/batch.h> #include <vespa/storage/storageserver/statemanager.h> #include <vespa/fastos/file.h> -#include <fstream> -#include <memory> -#include <atomic> #include <vespa/log/log.h> LOG_SETUP(".filestormanagertest"); @@ -2364,10 +2355,8 @@ namespace { closeNextLink(); } - virtual void print(std::ostream& out, bool, const std::string&) const override - { out << "MidLink"; } - - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { + void print(std::ostream& out, bool, const std::string&) const override { out << "MidLink"; } + bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { if (!StorageLinkTest::callOnUp(_up, msg)) _up.sendUp(msg); return true; } @@ -2395,10 +2384,9 @@ namespace { _leftAddr(leftAddr), _rightAddr(rightAddr) {} - virtual void print(std::ostream& out, bool, const std::string&) const override - { out << "BinaryStorageLink"; } + void print(std::ostream& out, bool, const std::string&) const override { out << "BinaryStorageLink"; } - virtual bool onDown(const std::shared_ptr<api::StorageMessage> & msg) override { + bool onDown(const std::shared_ptr<api::StorageMessage> & msg) override { // LOG(debug, "onDown Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); @@ -2432,7 +2420,7 @@ namespace { return true; } - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { + bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { // LOG(debug, "onUp Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); diff --git a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp index d608bef3307..1409445b96b 100644 --- a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.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 <memory> + #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> diff --git a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp index 2dc60594c45..58b4ae4d475 100644 --- a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp +++ b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp @@ -1,14 +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/vdstestlib/cppunit/macros.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> #include <tests/common/teststorageapp.h> -#include <tests/common/dummystoragelink.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <vespa/storage/persistence/filestorage/modifiedbucketchecker.h> -#include <vespa/storage/persistence/messages.h> namespace storage { diff --git a/storage/src/tests/persistence/legacyoperationhandlertest.cpp b/storage/src/tests/persistence/legacyoperationhandlertest.cpp index df262501299..353a8d24ec5 100644 --- a/storage/src/tests/persistence/legacyoperationhandlertest.cpp +++ b/storage/src/tests/persistence/legacyoperationhandlertest.cpp @@ -1,15 +1,12 @@ // 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/document/base/testdocrepo.h> -#include <vespa/document/repo/documenttyperepo.h> #include <vespa/documentapi/loadtypes/loadtype.h> #include <vespa/storage/persistence/messages.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storageapi/message/multioperation.h> #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <tests/persistence/persistencetestutils.h> -#include <vespa/storage/persistence/types.h> using document::DocumentTypeRepo; using document::TestDocRepo; diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp index 8147992a516..3f0623fbef0 100644 --- a/storage/src/tests/persistence/mergehandlertest.cpp +++ b/storage/src/tests/persistence/mergehandlertest.cpp @@ -3,15 +3,13 @@ #include <vespa/document/base/testdocman.h> #include <vespa/storage/persistence/mergehandler.h> #include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/storageapi/message/bucket.h> -#include <vespa/log/log.h> #include <tests/persistence/persistencetestutils.h> #include <tests/persistence/common/persistenceproviderwrapper.h> #include <tests/distributor/messagesenderstub.h> -#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> #include <vespa/vespalib/objects/nbostream.h> #include <cmath> +#include <vespa/log/log.h> LOG_SETUP(".test.persistence.handler.merge"); namespace storage { diff --git a/storage/src/tests/persistence/providershutdownwrappertest.cpp b/storage/src/tests/persistence/providershutdownwrappertest.cpp index 8b1ef88aa2c..c7f60a39cc8 100644 --- a/storage/src/tests/persistence/providershutdownwrappertest.cpp +++ b/storage/src/tests/persistence/providershutdownwrappertest.cpp @@ -1,10 +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/vdstestlib/cppunit/macros.h> #include <tests/persistence/persistencetestutils.h> #include <tests/persistence/common/persistenceproviderwrapper.h> -#include <vespa/storage/persistence/providershutdownwrapper.h> namespace storage { diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index e5b9a3e6092..751d6b535a3 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -1,10 +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 <boost/pointer_cast.hpp> #include <cppunit/extensions/HelperMacros.h> -#include <iostream> -#include <string> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> #include <vespa/storageapi/message/stat.h> diff --git a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp index d9a175f3b04..f4eedc64971 100644 --- a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp +++ b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp @@ -1,18 +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 <boost/lexical_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <vespa/log/log.h> #include <vespa/storage/bucketdb/bucketmanager.h> -#include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/storageserver/bucketintegritychecker.h> -#include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/persistence.h> #include <tests/common/testhelper.h> #include <tests/common/storagelinktest.h> -#include <tests/common/dummystoragelink.h> #include <vespa/vespalib/io/fileutil.h> #include <tests/common/teststorageapp.h> diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp index 8eb6b74a840..89eaff0ab6e 100644 --- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp +++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.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 <vespa/document/base/testdocman.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/storage/bucketdb/storbucketdb.h> @@ -15,7 +14,6 @@ #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <vespa/storage/storageserver/changedbucketownershiphandler.h> -#include <memory> namespace storage { diff --git a/storage/src/tests/storageserver/priorityconvertertest.cpp b/storage/src/tests/storageserver/priorityconvertertest.cpp index ecbbd25b8b1..ab6c27f48d6 100644 --- a/storage/src/tests/storageserver/priorityconvertertest.cpp +++ b/storage/src/tests/storageserver/priorityconvertertest.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 <vespa/documentapi/documentapi.h> #include <vespa/storage/storageserver/priorityconverter.h> #include <tests/common/testhelper.h> diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp index 4244ce0c4ce..f9c5c97e6bc 100644 --- a/storage/src/tests/storageserver/statemanagertest.cpp +++ b/storage/src/tests/storageserver/statemanagertest.cpp @@ -1,19 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <boost/pointer_cast.hpp> #include <cppunit/extensions/HelperMacros.h> #include <vespa/metrics/metricmanager.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/state.h> -#include <vespa/vdslib/state/nodestate.h> #include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> #include <vespa/storage/storageserver/statemanager.h> -#include <vespa/storage/common/hostreporter/hostinfo.h> #include <tests/common/teststorageapp.h> #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <vespa/vespalib/data/slime/slime.h> -#include <iostream> using storage::lib::NodeState; using storage::lib::NodeType; @@ -138,8 +134,7 @@ namespace { MyStateListener(const NodeStateUpdater& upd) : updater(upd), current(*updater.getReportedNodeState()) {} - void handleNewState() override - { + void handleNewState() override { ost << current << " -> "; current = *updater.getReportedNodeState(); ost << current << "\n"; @@ -259,4 +254,3 @@ StateManagerTest::testClusterStateVersion() } } // storage - diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index 265b9e95d83..8a164361c88 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -18,8 +18,8 @@ namespace storage { class DummyApplicationGenerationFether : public ApplicationGenerationFetcher { public: - virtual int64_t getGeneration() const override { return 1; } - virtual std::string getComponentName() const override { return "component"; } + int64_t getGeneration() const override { return 1; } + std::string getComponentName() const override { return "component"; } }; struct StateReporterTest : public CppUnit::TestFixture { @@ -58,10 +58,8 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const override - { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const override - { return _clock.getTimeInMillis().getTime(); } + time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } + time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/storageutil/charttest.cpp b/storage/src/tests/storageutil/charttest.cpp index 4f83a9f26f4..c7c1c43b000 100644 --- a/storage/src/tests/storageutil/charttest.cpp +++ b/storage/src/tests/storageutil/charttest.cpp @@ -1,18 +1,13 @@ // 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/storageutil/piechart.h> - -#include <fstream> #include <vespa/vdstestlib/cppunit/macros.h> +#include <fstream> namespace storage { struct PieChartTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testWriteHtmlFile(); CPPUNIT_TEST_SUITE(PieChartTest); diff --git a/storage/src/tests/storageutil/palettetest.cpp b/storage/src/tests/storageutil/palettetest.cpp index e5a4e73d58a..24eaee18996 100644 --- a/storage/src/tests/storageutil/palettetest.cpp +++ b/storage/src/tests/storageutil/palettetest.cpp @@ -1,15 +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/storage/storageutil/palette.h> #include <vespa/vdstestlib/cppunit/macros.h> namespace storage { struct PaletteTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testNormalUsage(); CPPUNIT_TEST_SUITE(PaletteTest); diff --git a/storage/src/tests/testrunner.cpp b/storage/src/tests/testrunner.cpp index 5d8dc8d4c1f..9bf86e3276a 100644 --- a/storage/src/tests/testrunner.cpp +++ b/storage/src/tests/testrunner.cpp @@ -1,14 +1,12 @@ // 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 <iostream> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storagecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index 8aa57b982db..1824b976aea 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -1,15 +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/document/datatype/datatype.h> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/document/fieldvalue/rawfieldvalue.h> -#include <vespa/log/log.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/persistence.h> -#include <vespa/storageapi/message/visitor.h> -#include <vector> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/visiting/visitormanager.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> @@ -17,16 +13,11 @@ #include <tests/common/testhelper.h> #include <tests/common/dummystoragelink.h> #include <tests/storageserver/testvisitormessagesession.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vdslib/container/visitorordering.h> #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/vespalib/util/exceptions.h> - -LOG_SETUP(".visitormanagertest"); - namespace storage { namespace { typedef std::vector<api::StorageMessage::SP> msg_ptr_vector; @@ -113,7 +104,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(VisitorManagerTest); void VisitorManagerTest::initializeTest() { - LOG(debug, "Initializing test"); vdstestlib::DirConfig config(getStandardConfig(true)); config.getConfig("stor-visitor").set("visitorthreads", "1"); @@ -221,7 +211,6 @@ VisitorManagerTest::initializeTest() CPPUNIT_ASSERT_EQUAL(api::ReturnCode(api::ReturnCode::OK), reply->getResult()); } - LOG(debug, "Done initializing test"); } void diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index e6a3542cbf2..84f1297b05f 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -6,25 +6,17 @@ #include <vespa/document/fieldvalue/rawfieldvalue.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/persistence.h> -#include <vespa/storageapi/message/visitor.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> #include <vespa/storage/visiting/visitormanager.h> #include <tests/common/testhelper.h> #include <tests/common/teststorageapp.h> #include <tests/common/dummystoragelink.h> #include <tests/storageserver/testvisitormessagesession.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vdslib/container/visitorordering.h> #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/vespalib/util/exceptions.h> -#include <vector> #include <thread> -#include <chrono> - -#include <vespa/log/log.h> -LOG_SETUP(".visitortest"); using namespace std::chrono_literals; @@ -185,7 +177,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(VisitorTest); void VisitorTest::initializeTest(const TestParams& params) { - LOG(debug, "Initializing test"); vdstestlib::DirConfig config(getStandardConfig(true, "visitortest")); config.getConfig("stor-visitor").set("visitorthreads", "1"); config.getConfig("stor-visitor").set( @@ -273,7 +264,6 @@ VisitorTest::initializeTest(const TestParams& params) _documents.back()->setValue(type.getField("headerval"), document::IntFieldValue(i % 4)); } - LOG(debug, "Done initializing test"); } void diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index 64498386466..da8dcf1c1cd 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -102,8 +102,7 @@ public: ~BucketManager(); void startWorkerThread(); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Dump the whole database to the given output. Use for debugging. */ void dump(std::ostream& out) const; @@ -120,11 +119,11 @@ private: vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; - /** Event saying node is up and running. We can start to build cache. */ - virtual void onOpen() override; - virtual void onDoneInit() override { _doneInitialized = true; } - virtual void onClose() override; - virtual void onFlush(bool downwards) override; + /** Event saying node is up and running. We can start to build cache. */ + void onOpen() override; + void onDoneInit() override { _doneInitialized = true; } + void onClose() override; + void onFlush(bool downwards) override; void updateMetrics(bool updateDocCount); void updateMetrics(const MetricLockGuard &) override { updateMetrics(true); } diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h index b5d8a50cb16..e28d89967b2 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.h +++ b/storage/src/vespa/storage/bucketdb/judyarray.h @@ -83,7 +83,7 @@ public: data_type& operator[](key_type key); size_type getMemoryUsage() const; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; class ConstIterator : public vespalib::Printable { @@ -101,8 +101,7 @@ public: key_type key() const { return _key; } data_type value() const { return *_data; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; protected: // For creating end() iterator ConstIterator(const JudyArray&); @@ -227,4 +226,3 @@ JudyArray::ConstIterator::operator==(const JudyArray::ConstIterator &cp) const } } // storage - diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h index 93dfb23c4db..3c40c214136 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.h +++ b/storage/src/vespa/storage/bucketdb/lockablemap.h @@ -168,7 +168,7 @@ public: const char* clientId, uint32_t chunkSize = DEFAULT_CHUNK_SIZE); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * Returns all buckets in the bucket database that can contain the given diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp index a271803714a..10a6bb6bd24 100644 --- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp +++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp @@ -1,5 +1,4 @@ // 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/bucketdb/mapbucketdatabase.h> #include <vespa/storage/common/bucketoperationlogger.h> @@ -465,7 +464,7 @@ namespace { struct Writer : public BucketDatabase::EntryProcessor { std::ostream& _ost; Writer(std::ostream& ost) : _ost(ost) {} - virtual bool process(const BucketDatabase::Entry& e) override { + bool process(const BucketDatabase::Entry& e) override { _ost << e.toString() << "\n"; return true; } diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h index 6e9bef38672..4c87c39fdd2 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h @@ -138,12 +138,12 @@ public: ServiceLayerComponentRegister&); ~StorageBucketDBInitializer(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void onOpen() override; - virtual void onClose() override; + void onOpen() override; + void onClose() override; - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; bool onDown(const std::shared_ptr<api::StorageMessage>&) override; bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; @@ -215,4 +215,3 @@ public: }; } // storage - diff --git a/storage/src/vespa/storage/bucketmover/run.h b/storage/src/vespa/storage/bucketmover/run.h index a626960eec7..d05020e6ba5 100644 --- a/storage/src/vespa/storage/bucketmover/run.h +++ b/storage/src/vespa/storage/bucketmover/run.h @@ -15,12 +15,13 @@ #pragma once -#include <list> -#include <map> + #include <vespa/storage/bucketmover/move.h> #include <vespa/storage/bucketmover/runstatistics.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/nodestate.h> +#include <list> +#include <map> namespace storage { @@ -91,8 +92,7 @@ public: RunStatistics& getStatistics() { return _statistics; } const RunStatistics& getStatistics() const { return _statistics; } - - virtual void print(std::ostream&, bool verbose, const std::string& indent) const override; + void print(std::ostream&, bool verbose, const std::string& indent) const override; private: void removePending(Move&); void finalize(); @@ -100,4 +100,3 @@ private: } // bucketmover } // storage - diff --git a/storage/src/vespa/storage/common/messagesender.h b/storage/src/vespa/storage/common/messagesender.h index 025695dff29..332103e12db 100644 --- a/storage/src/vespa/storage/common/messagesender.h +++ b/storage/src/vespa/storage/common/messagesender.h @@ -16,6 +16,7 @@ #pragma once +#include <memory> namespace storage { namespace api { diff --git a/storage/src/vespa/storage/common/servicelayercomponent.h b/storage/src/vespa/storage/common/servicelayercomponent.h index e54421b1ce3..5b9db275b27 100644 --- a/storage/src/vespa/storage/common/servicelayercomponent.h +++ b/storage/src/vespa/storage/common/servicelayercomponent.h @@ -25,7 +25,7 @@ #pragma once -#include <vespa/storage/common/storagecomponent.h> +#include "storagecomponent.h" namespace storage { @@ -54,12 +54,10 @@ class ServiceLayerComponent : public StorageComponent, StorBucketDatabase* _bucketDatabase; MinimumUsedBitsTracker* _minUsedBitsTracker; - // ServiceLayerManagedComponent implementation - virtual void setDiskCount(uint16_t count) override { _diskCount = count; } - virtual void setBucketDatabase(StorBucketDatabase& db) override { - _bucketDatabase = &db; - } - virtual void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) override { + // ServiceLayerManagedComponent implementation + void setDiskCount(uint16_t count) override { _diskCount = count; } + void setBucketDatabase(StorBucketDatabase& db) override { _bucketDatabase = &db; } + void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) override { _minUsedBitsTracker = &tracker; } public: @@ -91,4 +89,3 @@ public: }; } // storage - diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.h b/storage/src/vespa/storage/common/statusmetricconsumer.h index 0027cef9cd0..6a2c18f78bd 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.h +++ b/storage/src/vespa/storage/common/statusmetricconsumer.h @@ -9,11 +9,11 @@ #pragma once +#include "storagecomponent.h" #include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> #include <map> #include <vespa/metrics/metrics.h> -#include <vespa/storage/common/storagecomponent.h> #include <vespa/storageframework/storageframework.h> namespace vespalib { diff --git a/storage/src/vespa/storage/common/storagelink.h b/storage/src/vespa/storage/common/storagelink.h index e9ea8403321..a9af5fa5622 100644 --- a/storage/src/vespa/storage/common/storagelink.h +++ b/storage/src/vespa/storage/common/storagelink.h @@ -19,13 +19,11 @@ #pragma once -#include <vespa/vespalib/util/printable.h> -#include <memory> +#include "messagesender.h" +#include "storagecomponent.h" #include <vespa/storageapi/messageapi/messagehandler.h> #include <vespa/storageapi/messageapi/storagemessage.h> -#include <string> -#include <vespa/storage/common/messagesender.h> -#include <vespa/storage/common/storagecomponent.h> +#include <vespa/vespalib/util/printable.h> namespace storage { @@ -84,10 +82,10 @@ public: void flush(); /** Send message down the storage chain. */ - virtual void sendDown(const api::StorageMessage::SP&); + void sendDown(const api::StorageMessage::SP&) override; /** Send message up the storage chain. */ - virtual void sendUp(const api::StorageMessage::SP&); + void sendUp(const api::StorageMessage::SP&) override; void printChain(std::ostream&, std::string indent = "") const; @@ -126,8 +124,7 @@ public: */ virtual bool onUp(const api::StorageMessage::SP&); - virtual void print(std::ostream& out, bool, - const std::string&) const { + void print(std::ostream& out, bool, const std::string&) const override { out << getName(); } @@ -188,4 +185,3 @@ private: std::ostream& operator<<(std::ostream& out, StorageLink& link); } - diff --git a/storage/src/vespa/storage/common/storagelinkqueued.h b/storage/src/vespa/storage/common/storagelinkqueued.h index cd7b91a7a68..c894b6196e8 100644 --- a/storage/src/vespa/storage/common/storagelinkqueued.h +++ b/storage/src/vespa/storage/common/storagelinkqueued.h @@ -14,11 +14,11 @@ #pragma once +#include "storagelink.h" +#include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/document_runnable.h> #include <deque> #include <limits> -#include <vespa/storageframework/storageframework.h> -#include <vespa/storage/common/storagelink.h> namespace storage { @@ -40,13 +40,13 @@ public: void dispatchUp(const std::shared_ptr<api::StorageMessage>&); /** Remember to call this method if you override it. */ - virtual void onClose() override { + void onClose() override { _commandDispatcher.flush(); _closeState |= 1; } /** Remember to call this method if you override it. */ - virtual void onFlush(bool downwards) override { + void onFlush(bool downwards) override { if (downwards) { _commandDispatcher.flush(); _closeState |= 2; @@ -79,7 +79,7 @@ private: public: Dispatcher(StorageLinkQueued& parent, unsigned int maxQueueSize, bool replyDispatcher); - virtual ~Dispatcher(); + ~Dispatcher(); void start(); void run(framework::ThreadHandle&) override; @@ -106,7 +106,7 @@ private: void send(const std::shared_ptr<api::StorageMessage> & reply) override { _parent.sendUp(reply); } - virtual ~ReplyDispatcher() { terminate(); } + ~ReplyDispatcher() { terminate(); } }; class CommandDispatcher : public Dispatcher<api::StorageMessage> @@ -117,7 +117,7 @@ private: parent, std::numeric_limits<unsigned int>::max(), false) { } - virtual ~CommandDispatcher() { terminate(); } + ~CommandDispatcher() { terminate(); } void send(const std::shared_ptr<api::StorageMessage> & command) override { _parent.sendDown(command); } @@ -132,7 +132,6 @@ private: protected: ReplyDispatcher& getReplyDispatcher() { return _replyDispatcher; } - }; } diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index b87f0e5f898..a8f76c2c7a0 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -49,23 +49,14 @@ public: const std::shared_ptr<api::RequestBucketInfoReply> & repl) override; bool onMergeBucketReply(const std::shared_ptr<api::MergeBucketReply>& reply) override; - bool onNotifyBucketChange(const std::shared_ptr<api::NotifyBucketChangeCommand>&) override; - void resendDelayedMessages(); - void storageDistributionChanged(const lib::Distribution&); - vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, - const framework::HttpUrlPath&) const; - - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string reportXmlStatus(vespalib::xml::XmlOutputStream&, const framework::HttpUrlPath&) const; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; - - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; - + void print(std::ostream& out, bool verbose, const std::string& indent) const; DistributorComponent& getDistributorComponent() { return _bucketSpaceComponent; } /** @@ -240,12 +231,8 @@ private: _upStates(upStates) {} ~NodeRemover(); - - virtual bool process(BucketDatabase::Entry& e) override; - - void logRemove(const document::BucketId& bucketId, - const char* msg) const; - + bool process(BucketDatabase::Entry& e) override; + void logRemove(const document::BucketId& bucketId, const char* msg) const; bool distributorOwnsBucket(const document::BucketId&) const; const std::vector<document::BucketId>& getBucketsToRemove() const { @@ -266,8 +253,7 @@ private: const char* _upStates; }; - std::deque<std::pair<framework::MilliSecTime, - BucketRequest> > _delayedRequests; + std::deque<std::pair<framework::MilliSecTime, BucketRequest> > _delayedRequests; std::map<uint64_t, BucketRequest> _sentMessages; std::unique_ptr<PendingClusterState> _pendingClusterState; std::list<PendingClusterState::Summary> _history; @@ -280,4 +266,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index 40d6ee76e07..182988104a9 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -2,7 +2,6 @@ #pragma once - #include "idealstatemanager.h" #include "bucketdbupdater.h" #include "pendingmessagetracker.h" @@ -22,7 +21,6 @@ #include <vespa/storageframework/generic/thread/tickingthread.h> #include <vespa/config/config.h> #include <vespa/vespalib/util/sync.h> - #include <unordered_map> namespace storage { @@ -57,16 +55,12 @@ public: ~Distributor(); void onOpen() override; - void onClose() override; - bool onDown(const std::shared_ptr<api::StorageMessage>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void sendDown(const std::shared_ptr<api::StorageMessage>&) override; - virtual ChainedMessageSender& getMessageSender() override { + ChainedMessageSender& getMessageSender() override { return (_messageSender == 0 ? *this : *_messageSender); } @@ -99,8 +93,7 @@ public: bool handleReply(const std::shared_ptr<api::StorageReply>& reply) override; // StatusReporter implementation - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; bool handleStatusRequest(const DelegatedStatusRequest& request) const override; @@ -117,8 +110,7 @@ public: * Checks whether a bucket needs to be split, and sends a split * if so. */ - void checkBucketForSplit(const BucketDatabase::Entry& e, - uint8_t priority) override; + void checkBucketForSplit(const BucketDatabase::Entry& e, uint8_t priority) override; const lib::Distribution& getDistribution() const override; @@ -130,8 +122,9 @@ public: * @return Returns the states in which the distributors consider * storage nodes to be up. */ - const char* getStorageNodeUpStates() const override - { return _initializingIsUp ? "uri" : "ur"; } + const char* getStorageNodeUpStates() const override { + return _initializingIsUp ? "uri" : "ur"; + } /** * Called by bucket db updater after a merge has finished, and all the @@ -154,13 +147,10 @@ public: } int getDistributorIndex() const override; - const std::string& getClusterName() const override; - const PendingMessageTracker& getPendingMessageTracker() const override; - - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; - virtual void sendReply(const std::shared_ptr<api::StorageReply>&) override; + void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; + void sendReply(const std::shared_ptr<api::StorageReply>&) override; const BucketGcTimeCalculator::BucketIdHasher& getBucketIdHasher() const override { diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.h b/storage/src/vespa/storage/distributor/operations/external/getoperation.h index ecdfb1e677a..57a7c55fb81 100644 --- a/storage/src/vespa/storage/distributor/operations/external/getoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.h @@ -6,15 +6,11 @@ #include <vespa/storage/bucketdb/bucketcopy.h> #include <vespa/storageapi/messageapi/storagemessage.h> -namespace document { -class Document; -} +namespace document { class Document; } namespace storage { -namespace api { -class GetCommand; -} +namespace api { class GetCommand; } class PersistenceOperationMetricSet; @@ -30,13 +26,9 @@ public: PersistenceOperationMetricSet& metric); void onClose(DistributorMessageSender& sender) override; - void onStart(DistributorMessageSender& sender) override; - void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override; - const char* getName() const override { return "get"; } - std::string getStatus() const override { return ""; } bool hasConsistentCopies() const; @@ -48,13 +40,9 @@ private: GroupId(const document::BucketId& id, uint32_t checksum, int node); bool operator<(const GroupId& other) const; - bool operator==(const GroupId& other) const; - const document::BucketId& getBucketId() const { return _id; } - int getNode() const { return _node; } - private: document::BucketId _id; uint32_t _checksum; @@ -65,7 +53,8 @@ private: public: BucketChecksumGroup(const BucketCopy& c) : copy(c), - sent(0), received(false), returnCode(api::ReturnCode::OK) {}; + sent(0), received(false), returnCode(api::ReturnCode::OK) + {} BucketCopy copy; api::StorageMessage::Id sent; @@ -105,8 +94,4 @@ private: }; } - - } - - diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.h b/storage/src/vespa/storage/distributor/operations/external/putoperation.h index 5043fed307f..6ba9e9c3dbf 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.h @@ -28,14 +28,9 @@ public: PersistenceOperationMetricSet& metric); void onStart(DistributorMessageSender& sender) override; - - const char* getName() const override { return "put"; } - - std::string getStatus() const override { return ""; } - - void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> &) override; - + const char* getName() const override { return "put"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> &) override; void onClose(DistributorMessageSender& sender) override; /** @@ -71,11 +66,9 @@ private: const uint16_t node, std::vector<PersistenceMessageTracker::ToSend>& putBatch); - bool shouldImplicitlyActivateReplica( - const OperationTargetList& targets) const; + bool shouldImplicitlyActivateReplica(const OperationTargetList& targets) const; std::shared_ptr<api::PutCommand> _msg; - DistributorComponent& _manager; }; diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h index 25cc0825b7d..dce744b6648 100644 --- a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h @@ -7,9 +7,7 @@ namespace storage { -namespace api { -class GetBucketListCommand; -} +namespace api { class GetBucketListCommand; } namespace distributor { @@ -23,22 +21,21 @@ public: const MaintenanceOperationGenerator& generator, uint16_t distributorIndex, const std::shared_ptr<api::GetBucketListCommand>& cmd); - virtual ~StatBucketListOperation() {} + ~StatBucketListOperation() {} - virtual const char* getName() const override { return "statBucketList"; } - virtual std::string getStatus() const override { return ""; } + const char* getName() const override { return "statBucketList"; } + std::string getStatus() const override { return ""; } - virtual void onStart(DistributorMessageSender& sender) override; - virtual void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override { + void onStart(DistributorMessageSender& sender) override; + void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override + { // Never called. assert(false); } - void onClose(DistributorMessageSender&) override { - } + void onClose(DistributorMessageSender&) override {} private: - void getBucketStatus(const BucketDatabase::Entry& entry, - std::ostream& os) const; + void getBucketStatus(const BucketDatabase::Entry& entry, std::ostream& os) const; const BucketDatabase& _bucketDb; const MaintenanceOperationGenerator& _generator; @@ -48,4 +45,3 @@ private: } // distributor } // storage - diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp index 15f8d06965a..7b1ff03b8af 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp @@ -52,24 +52,24 @@ struct IntermediateMessageSender : DistributorMessageSender { DistributorMessageSender & fwd); ~IntermediateMessageSender(); - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override { + void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override { msgMap.insert(cmd->getMsgId(), callback); forward.sendCommand(cmd); }; - virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) override { + void sendReply(const std::shared_ptr<api::StorageReply>& reply) override { _reply = reply; } - virtual int getDistributorIndex() const override { + int getDistributorIndex() const override { return forward.getDistributorIndex(); } - virtual const std::string& getClusterName() const override { + const std::string& getClusterName() const override { return forward.getClusterName(); } - virtual const PendingMessageTracker& getPendingMessageTracker() const override { + const PendingMessageTracker& getPendingMessageTracker() const override { return forward.getPendingMessageTracker(); } }; diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h index 0a2a9e564a0..fef9c01efa9 100644 --- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h @@ -25,14 +25,9 @@ public: PersistenceOperationMetricSet& metric); void onStart(DistributorMessageSender& sender) override; - - const char* getName() const override { return "update"; } - - std::string getStatus() const override { return ""; } - - void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> & msg) override; - + const char* getName() const override { return "update"; }; + std::string getStatus() const override { return ""; }; + void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override; void onClose(DistributorMessageSender& sender) override; std::pair<document::BucketId, uint16_t> getNewestTimestampLocation() const { @@ -65,4 +60,3 @@ private: } } - diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h index 802bb0f4bac..fd133674bd1 100644 --- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h +++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h @@ -2,8 +2,8 @@ #pragma once +#include "operationtargetresolver.h" #include <vespa/storage/bucketdb/bucketdatabase.h> -#include <vespa/storage/distributor/operationtargetresolver.h> #include <vespa/vdslib/distribution/idealnodecalculator.h> namespace storage { @@ -91,23 +91,20 @@ public: _idealNodeCalculator(idealNodeCalc), _minUsedBucketBits(minUsedBucketBits), _redundancy(redundancy) - { - } + {} BucketInstanceList getAllInstances(OperationType type, const document::BucketId& id); - BucketInstanceList getInstances(OperationType type, const document::BucketId& id) - { + BucketInstanceList getInstances(OperationType type, const document::BucketId& id) { BucketInstanceList result(getAllInstances(type, id)); result.limitToRedundancyCopies(_redundancy); return result; } - virtual OperationTargetList getTargets(OperationType type, - const document::BucketId& id) override - { return getInstances(type, id).createTargets(); } + OperationTargetList getTargets(OperationType type, const document::BucketId& id) override { + return getInstances(type, id).createTargets(); + } }; } // distributor } // storage - diff --git a/storage/src/vespa/storage/distributor/statecheckers.h b/storage/src/vespa/storage/distributor/statecheckers.h index 0113749f2fd..dbd9503f9f2 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.h +++ b/storage/src/vespa/storage/distributor/statecheckers.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/storage/distributor/idealstatemanager.h> +#include "idealstatemanager.h" namespace storage { @@ -11,9 +11,7 @@ class SynchronizeAndMoveStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Synchronization and moving"; } - Result check(Context& c) override; - const char* getName() const override { return "SynchronizeAndMove"; } }; @@ -21,9 +19,7 @@ class DeleteExtraCopiesStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Delete extra copies"; } - Result check(Context& c) override; - const char* getName() const override { return "DeleteExtraCopies"; } private: @@ -49,9 +45,7 @@ class JoinBucketsStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Join buckets"; } - Result check(Context& c) override; - const char* getName() const override { return "JoinBuckets"; } private: uint64_t getTotalUsedFileSize(const Context& c) const; @@ -69,13 +63,9 @@ class SplitBucketStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Split buckets"; } - Result check(Context& c) override; - const char* getName() const override { return "SplitBucket"; } - private: - Result generateMinimumBucketSplitOperation(Context& c); Result generateMaxSizeExceededSplitOperation(Context& c); @@ -86,11 +76,8 @@ private: class SplitInconsistentStateChecker : public StateChecker { public: - std::string getStatusText() const override - { return "Fix inconsistently split buckets"; } - + std::string getStatusText() const override { return "Fix inconsistently split buckets"; } Result check(Context& c) override; - const char* getName() const override { return "SplitInconsistentBuckets"; } private: @@ -115,9 +102,7 @@ class BucketStateStateChecker : public StateChecker const StateChecker::Context& c) const; public: std::string getStatusText() const override { return "Set bucket copy state"; } - Result check(Context& c) override; - const char* getName() const override { return "SetBucketState"; } }; @@ -125,15 +110,11 @@ class GarbageCollectionStateChecker : public StateChecker { public: std::string getStatusText() const override { return "Garbage collection"; } - bool needsGarbageCollection(const Context& c) const; - Result check(Context& c) override; - const char* getName() const override { return "GarbageCollection"; } }; } } - diff --git a/storage/src/vespa/storage/distributor/statusreporterdelegate.h b/storage/src/vespa/storage/distributor/statusreporterdelegate.h index 0c836910765..93a1fe1cd48 100644 --- a/storage/src/vespa/storage/distributor/statusreporterdelegate.h +++ b/storage/src/vespa/storage/distributor/statusreporterdelegate.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "delegatedstatusrequest.h" +#include "statusdelegator.h" #include <vespa/storageframework/storageframework.h> -#include <vespa/storage/distributor/delegatedstatusrequest.h> -#include <vespa/storage/distributor/statusdelegator.h> namespace storage { namespace distributor { @@ -20,9 +20,7 @@ public: const framework::StatusReporter& target); void registerStatusPage(); - - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h index 2cf0255bf9f..90ddb71d678 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h @@ -7,10 +7,10 @@ */ #pragma once +#include "storagecomponentregisterimpl.h" #include <vespa/storage/bucketdb/mapbucketdatabase.h> #include <vespa/storage/common/distributorcomponent.h> #include <vespa/storage/common/nodestateupdater.h> -#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> namespace storage { namespace lib { @@ -36,18 +36,13 @@ public: DistributorComponentRegisterImpl(); ~DistributorComponentRegisterImpl(); - virtual void registerDistributorComponent(DistributorManagedComponent&) override; - + void registerDistributorComponent(DistributorManagedComponent&) override; void setTimeCalculator(UniqueTimeCalculator& calc); void setDistributorConfig(const DistributorConfig&); void setVisitorConfig(const VisitorConfig&); - private: - virtual void handleNewState() override; - - virtual void setNodeStateUpdater(NodeStateUpdater& updater) override; + void handleNewState() override; + void setNodeStateUpdater(NodeStateUpdater& updater) override; }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h index 7d322f027d5..d071ba8ba3e 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h @@ -7,10 +7,10 @@ */ #pragma once +#include "storagecomponentregisterimpl.h" #include <vespa/storage/bucketdb/minimumusedbitstracker.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/common/servicelayercomponent.h> -#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h> namespace storage { @@ -35,11 +35,8 @@ public: return _minUsedBitsTracker; } - virtual void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; - + void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; void setDiskCount(uint16_t count); }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp index 51a30d26def..4f2ed2bfc25 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp @@ -14,9 +14,9 @@ StorageComponentRegisterImpl::StorageComponentRegisterImpl() _index(0xffff), _loadTypes(new documentapi::LoadTypeSet), _nodeStateUpdater(0) -{ +{ } -} +StorageComponentRegisterImpl::~StorageComponentRegisterImpl() { } void StorageComponentRegisterImpl::registerStorageComponent(StorageComponent& smc) diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index cf9abbb6864..38773be167f 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -40,6 +40,7 @@ public: typedef std::unique_ptr<StorageComponentRegisterImpl> UP; StorageComponentRegisterImpl(); + ~StorageComponentRegisterImpl(); const vespalib::string& getClusterName() const { return _clusterName; } const lib::NodeType& getNodeType() const @@ -47,13 +48,12 @@ public: uint16_t getIndex() const { return _index; } document::DocumentTypeRepo::SP getTypeRepo() { return _docTypeRepo; } documentapi::LoadTypeSet::SP getLoadTypes() { return _loadTypes; } - const document::BucketIdFactory& getBucketIdFactory() - { return _bucketIdFactory; } + const document::BucketIdFactory& getBucketIdFactory() { return _bucketIdFactory; } lib::Distribution::SP getDistribution() { return _distribution; } NodeStateUpdater& getNodeStateUpdater() { assert(_nodeStateUpdater != 0); return *_nodeStateUpdater; } - virtual void registerStorageComponent(StorageComponent&) override; + void registerStorageComponent(StorageComponent&) override; void setNodeInfo(vespalib::stringref clusterName, const lib::NodeType& nodeType, @@ -68,5 +68,3 @@ public: }; } // storage - - diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index 12e2c31068a..18e0f2280f8 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -236,7 +236,7 @@ StatusWebServer::WebServer::onGetRequest(const string & tmpurl, const string &se namespace { class IndexPageReporter : public framework::HtmlStatusReporter { std::ostringstream ost; - virtual void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override { + void reportHtmlStatus(std::ostream& out,const framework::HttpUrlPath&) const override{ out << ost.str(); } diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index c89c286387b..d1a0a33da95 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -10,13 +10,12 @@ #pragma once -#include <vespa/vespalib/stllike/string.h> -#include <vespa/fastlib/net/httpserver.h> -#include <list> #include <vespa/storage/config/config-stor-status.h> #include <vespa/storageframework/storageframework.h> #include <vespa/config/config.h> #include <vespa/config/helper/configfetcher.h> +#include <vespa/fastlib/net/httpserver.h> +#include <list> namespace storage { @@ -30,7 +29,7 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: public: WebServer(StatusWebServer&, uint16_t port); - virtual void onGetRequest(const string & url, + void onGetRequest(const string & url, const string & serverSpec, Fast_HTTPConnection& conn) override; const vespalib::string &getServerSpec() const { @@ -69,16 +68,12 @@ public: virtual ~StatusWebServer(); void handlePage(const framework::HttpUrlPath&, std::ostream& out); - static vespalib::string getServerSpec(const vespalib::string &requestSpec, const vespalib::string &serverSpec); - private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config) override; void getPage(const char* url, Fast_HTTPConnection& conn); - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; }; } - diff --git a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h index b785c98e505..437927ccaf1 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h @@ -22,7 +22,7 @@ struct AppKiller { }; struct RealAppKiller : public AppKiller { - virtual void kill(); + void kill() override; }; } // storage diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp index 5d58a092053..2861ab904ff 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp @@ -2,8 +2,6 @@ #include "deadlockdetector.h" #include <vespa/storage/bucketdb/storbucketdb.h> -#include <vespa/storageframework/storageframework.h> -#include <vespa/vdslib/state/nodetype.h> #include <vespa/storage/bucketmover/htmltable.h> #include <vespa/vespalib/stllike/asciistream.h> @@ -146,10 +144,10 @@ namespace { ThreadChecker(DeadLockDetector& d, const framework::MilliSecTime& time) : _detector(d), _currentTime(time) {} - virtual void visitThread(const vespalib::string& id, - const framework::ThreadProperties& tp, - const framework::ThreadTickData& tick, - DeadLockDetector::State& state) override + void visitThread(const vespalib::string& id, + const framework::ThreadProperties& tp, + const framework::ThreadTickData& tick, + DeadLockDetector::State& state) override { // In case we just got a new tick, ignore the thread if (tick._lastTickMs > _currentTime.getTime()) return; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h index 146d0ccb751..c8cb3f35ddf 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h @@ -12,9 +12,9 @@ #pragma once +#include "appkiller.h" #include <vespa/storage/common/distributorcomponent.h> #include <vespa/storage/common/servicelayercomponent.h> -#include <vespa/storage/frameworkimpl/thread/appkiller.h> #include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/sync.h> #include <map> @@ -88,13 +88,9 @@ private: StorageComponent* _component; framework::Thread::UP _thread; - virtual void run(framework::ThreadHandle&) override; - - // Status implementation - virtual void reportHtmlStatus(std::ostream& out, - const framework::HttpUrlPath&) const override; + void run(framework::ThreadHandle&) override; + void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override; vespalib::string getBucketLockInfo() const; }; } - diff --git a/storage/src/vespa/storage/persistence/diskthread.h b/storage/src/vespa/storage/persistence/diskthread.h index 3626bbb2c70..a1af83a65ef 100644 --- a/storage/src/vespa/storage/persistence/diskthread.h +++ b/storage/src/vespa/storage/persistence/diskthread.h @@ -60,7 +60,7 @@ public: bool operator==(const OperationCount& c) const { return (count == c.count && pending == c.pending); } - void print(std::ostream& out, bool, const std::string&) const + void print(std::ostream& out, bool, const std::string&) const override { out << "OperationCount(" << count << (pending ? ", pending" : "") << ")"; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h index e658599a3dc..b549aca35b6 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h @@ -13,9 +13,9 @@ #pragma once +#include "mergestatus.h" #include <vespa/document/bucket/bucketid.h> #include <ostream> -#include <vespa/storage/persistence/filestorage/mergestatus.h> #include <vespa/storage/storageutil/resumeguard.h> #include <vespa/storage/common/messagesender.h> diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h index a6942102c42..39d9a60a950 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h @@ -8,6 +8,8 @@ #pragma once +#include "filestorhandler.h" +#include "filestormetrics.h" #include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> #include <vespa/document/bucket/bucketid.h> @@ -20,8 +22,7 @@ #include <vespa/storage/common/storagelinkqueued.h> #include <vespa/config-stor-filestor.h> #include <vespa/storage/persistence/diskthread.h> -#include <vespa/storage/persistence/filestorage/filestorhandler.h> -#include <vespa/storage/persistence/filestorage/filestormetrics.h> + #include <vespa/storage/persistence/providershutdownwrapper.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storage/common/nodestateupdater.h> @@ -104,7 +105,7 @@ public: ServiceLayerComponentRegister&); ~FileStorManager(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; // Return true if we are currently merging the given bucket. bool isMerging(const document::BucketId& bucket) const; @@ -122,8 +123,7 @@ public: private: void configure(std::unique_ptr<vespa::config::content::StorFilestorConfig> config) override; - void replyWithBucketNotFound(api::StorageMessage&, - const document::BucketId&); + void replyWithBucketNotFound(api::StorageMessage&, const document::BucketId&); void replyDroppedOperation(api::StorageMessage& msg, const document::BucketId& bucket, @@ -135,17 +135,12 @@ private: api::StorageMessage& msg, const char* callerId); - bool validateApplyDiffCommandBucket(api::StorageMessage& msg, - const StorBucketDatabase::WrappedEntry&); - bool validateDiffReplyBucket(const StorBucketDatabase::WrappedEntry&, - const document::BucketId&); + bool validateApplyDiffCommandBucket(api::StorageMessage& msg, const StorBucketDatabase::WrappedEntry&); + bool validateDiffReplyBucket(const StorBucketDatabase::WrappedEntry&, const document::BucketId&); - StorBucketDatabase::WrappedEntry mapOperationToDisk( - api::StorageMessage&, const document::BucketId&); - StorBucketDatabase::WrappedEntry mapOperationToBucketAndDisk( - api::BucketCommand&, const document::DocumentId*); - bool handlePersistenceMessage(const std::shared_ptr<api::StorageMessage>&, - uint16_t disk); + StorBucketDatabase::WrappedEntry mapOperationToDisk(api::StorageMessage&, const document::BucketId&); + StorBucketDatabase::WrappedEntry mapOperationToBucketAndDisk(api::BucketCommand&, const document::DocumentId*); + bool handlePersistenceMessage(const std::shared_ptr<api::StorageMessage>&, uint16_t disk); // Document operations bool onPut(const std::shared_ptr<api::PutCommand>&) override; @@ -175,23 +170,15 @@ private: bool onInternal(const std::shared_ptr<api::InternalCommand>&) override; bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; - void handleAbortBucketOperations( - const std::shared_ptr<AbortBucketOperationsCommand>&); - + void handleAbortBucketOperations(const std::shared_ptr<AbortBucketOperationsCommand>&); void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; void sendReply(const std::shared_ptr<api::StorageReply>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void onClose() override; void onFlush(bool downwards) override; - - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - - virtual void storageDistributionChanged() override; - + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + void storageDistributionChanged() override; void updateState(); }; } // storage - diff --git a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h index 9967fc24c7d..ff7e9e5dfb4 100644 --- a/storage/src/vespa/storage/persistence/filestorage/mergestatus.h +++ b/storage/src/vespa/storage/persistence/filestorage/mergestatus.h @@ -41,7 +41,7 @@ public: const std::vector<api::ApplyBucketDiffCommand::Entry>& part, uint16_t hasMask); void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; bool isFirstNode() const { return (reply.get() != 0); } }; diff --git a/storage/src/vespa/storage/persistence/persistencethread.h b/storage/src/vespa/storage/persistence/persistencethread.h index f4c70353fab..d2c4dba3a5f 100644 --- a/storage/src/vespa/storage/persistence/persistencethread.h +++ b/storage/src/vespa/storage/persistence/persistencethread.h @@ -2,15 +2,15 @@ #pragma once -#include <vespa/storage/common/statusmessages.h> -#include <vespa/storage/persistence/diskthread.h> -#include <vespa/storage/persistence/processallhandler.h> -#include <vespa/storage/persistence/mergehandler.h> -#include <vespa/storage/persistence/diskmoveoperationhandler.h> +#include "diskthread.h" +#include "processallhandler.h" +#include "mergehandler.h" +#include "diskmoveoperationhandler.h" +#include "persistenceutil.h" +#include "providershutdownwrapper.h" #include <vespa/storageframework/storageframework.h> #include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/persistence/persistenceutil.h> -#include <vespa/storage/persistence/providershutdownwrapper.h> +#include <vespa/storage/common/statusmessages.h> namespace storage { @@ -35,7 +35,7 @@ public: bool isMerging(const BucketId& bucket) const; - virtual framework::Thread& getThread() override { return *_thread; } + framework::Thread& getThread() override { return *_thread; } MessageTracker::UP handlePut(api::PutCommand& cmd); MessageTracker::UP handleRemove(api::RemoveCommand& cmd); @@ -99,10 +99,8 @@ private: void processMessages(FileStorHandler::LockedMessage & lock); // Thread main loop - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; bool checkForError(const spi::Result& response, MessageTracker& tracker); - spi::Bucket getBucket(const DocumentId& id, const BucketId& bucket) const; void flushAllReplies(const document::BucketId& bucketId, @@ -114,4 +112,3 @@ private: }; } // storage - diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp index 2095e19261c..c08b19a9e45 100644 --- a/storage/src/vespa/storage/persistence/processallhandler.cpp +++ b/storage/src/vespa/storage/persistence/processallhandler.cpp @@ -2,7 +2,6 @@ #include "processallhandler.h" #include "bucketprocessor.h" -#include <vespa/storage/common/bucketmessages.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/log/log.h> diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp index 8d816760815..62039f36133 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp +++ b/storage/src/vespa/storage/persistence/splitbitdetector.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 <vespa/storage/persistence/splitbitdetector.h> #include <vespa/storage/persistence/bucketprocessor.h> #include <vespa/document/bucket/bucketidfactory.h> diff --git a/storage/src/vespa/storage/storageserver/CMakeLists.txt b/storage/src/vespa/storage/storageserver/CMakeLists.txt index 17638f55b3a..79ce0206005 100644 --- a/storage/src/vespa/storage/storageserver/CMakeLists.txt +++ b/storage/src/vespa/storage/storageserver/CMakeLists.txt @@ -8,6 +8,7 @@ vespa_add_library(storage_storageserver fnetlistener.cpp rpcrequestwrapper.cpp communicationmanager.cpp + communicationmanagermetrics.cpp statemanager.cpp documentapiconverter.cpp opslogger.cpp @@ -20,6 +21,7 @@ vespa_add_library(storage_storageserver distributornode.cpp servicelayernode.cpp statereporter.cpp + storagemetricsset.cpp changedbucketownershiphandler.cpp INSTALL lib64 DEPENDS diff --git a/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h b/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h index 0e33c8c86c6..7d5b64c1d17 100644 --- a/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h +++ b/storage/src/vespa/storage/storageserver/applicationgenerationfetcher.h @@ -9,11 +9,14 @@ #pragma once +#include <cstdint> +#include <string> + namespace storage { class ApplicationGenerationFetcher { public: - virtual ~ApplicationGenerationFetcher() {}; + virtual ~ApplicationGenerationFetcher() {} virtual int64_t getGeneration() const = 0; virtual std::string getComponentName() const = 0; diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h index 6b87be804d0..fd9516a85aa 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h @@ -112,47 +112,29 @@ public: ServiceLayerComponentRegister&); ~BucketIntegrityChecker(); - virtual void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void onClose() override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; SchedulingOptions& getSchedulingOptions() { return _scheduleOptions; } - bool isWorkingOnCycle() const; - uint32_t getCycleCount() const; /** Give thread a bump by signalling it. */ void bump() const; - void setMaxThreadWaitTime(framework::MilliSecTime milliSecs) - { _maxThreadWaitTime = milliSecs; } + void setMaxThreadWaitTime(framework::MilliSecTime milliSecs) { _maxThreadWaitTime = milliSecs; } framework::Clock& getClock() { return _component.getClock(); } private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>) override; - + void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>) override; void onDoneInit() override; - bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&) override; - bool onNotifyBucketChangeReply( - const std::shared_ptr<api::NotifyBucketChangeReply>&) override - { return true; } - - SchedulingOptions::RunState getCurrentRunState( - framework::SecondTime time) const; - - virtual void run(framework::ThreadHandle&) override; - + bool onNotifyBucketChangeReply(const std::shared_ptr<api::NotifyBucketChangeReply>&) override { return true; } + SchedulingOptions::RunState getCurrentRunState(framework::SecondTime time) const; + void run(framework::ThreadHandle&) override; uint32_t getTotalPendingCount() const; - - // Status::Reporter implementation - virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const override; - + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; } - diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 31100de78d1..3cae63d3586 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. /** - - -* @class CommunicationManager + * @class CommunicationManager * @ingroup storageserver * * @brief Class used for sending messages over the network. @@ -12,26 +10,26 @@ #pragma once -#include <vespa/vespalib/util/document_runnable.h> -#include <map> -#include <memory> -#include <queue> -#include <vector> -#include <atomic> -#include <vespa/metrics/metrics.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/storageframework/storageframework.h> +#include <vespa/documentapi/documentapi.h> +#include "communicationmanagermetrics.h" +#include "messageallocationtypes.h" +#include "documentapiconverter.h" #include <vespa/storage/common/storagelink.h> #include <vespa/storage/config/config-stor-communicationmanager.h> +#include <vespa/storageframework/storageframework.h> +#include <vespa/storageframework/storageframework.h> #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/storagemessage.h> #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> -#include <vespa/documentapi/documentapi.h> -#include <vespa/storage/storageserver/communicationmanagermetrics.h> -#include <vespa/storage/storageserver/messageallocationtypes.h> -#include "documentapiconverter.h" -#include <vespa/storageframework/storageframework.h> +#include <vespa/messagebus/rpcmessagebus.h> +#include <vespa/metrics/metrics.h> +#include <vespa/vespalib/util/document_runnable.h> +#include <map> +#include <memory> +#include <queue> +#include <vector> +#include <atomic> namespace storage { @@ -189,43 +187,32 @@ private: public: CommunicationManager(StorageComponentRegister& compReg, const config::ConfigUri & configUri); - virtual ~CommunicationManager(); + ~CommunicationManager(); void enqueue(const std::shared_ptr<api::StorageMessage> & msg); - mbus::RPCMessageBus& getMessageBus() { assert(_mbus.get()); return *_mbus; } - const PriorityConverter& getPriorityConverter() const { return _docApiConverter.getPriorityConverter(); } /** * From StorageLink. Called when messages arrive from storage * modules. Will convert and dispatch messages to MessageServer */ - virtual bool onUp(const std::shared_ptr<api::StorageMessage>&) override; - + bool onUp(const std::shared_ptr<api::StorageMessage>&) override; bool sendCommand(const std::shared_ptr<api::StorageCommand>& command); - bool sendReply(const std::shared_ptr<api::StorageReply>& reply); void sendDirectRPCReply(RPCRequestWrapper& request, const std::shared_ptr<api::StorageReply>& reply); void sendMessageBusReply(StorageTransportContext& context, const std::shared_ptr<api::StorageReply>& reply); // Pump thread void run(framework::ThreadHandle&) override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - /** Get messages from messagebus. */ void handleMessage(std::unique_ptr<mbus::Message> msg) override; - void sendMessageBusMessage(const std::shared_ptr<api::StorageCommand>& msg, - std::unique_ptr<mbus::Message> mbusMsg, const mbus::Route& route); + std::unique_ptr<mbus::Message> mbusMsg, const mbus::Route& route); - /** Get replies from messagebus. */ void handleReply(std::unique_ptr<mbus::Reply> msg) override; - void updateMessagebusProtocol(const document::DocumentTypeRepo::SP &repo); - }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/communicationmanagermetrics.cpp b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.cpp new file mode 100644 index 00000000000..d1e71b6e8a5 --- /dev/null +++ b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.cpp @@ -0,0 +1,32 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "communicationmanagermetrics.h" +#include <vespa/documentapi/loadtypes/loadtypeset.h> + +using namespace metrics; +namespace storage { + +CommunicationManagerMetrics::CommunicationManagerMetrics(const LoadTypeSet& loadTypes, MetricSet* owner) + : MetricSet("communication", "", "Metrics for the communication manager", owner), + queueSize("messagequeue", "", "Size of input message queue.", this), + messageProcessTime(loadTypes, + DoubleAverageMetric("messageprocesstime", "", + "Time transport thread uses to process a single message"), + this), + exceptionMessageProcessTime(loadTypes, + DoubleAverageMetric("exceptionmessageprocesstime", "", + "Time transport thread uses to process a single message " + "that fails with an exception thrown into communication manager"), + this), + failedDueToTooLittleMemory("toolittlememory", "", "Number of messages failed due to too little memory available", this), + convertToStorageAPIFailures("convertfailures", "", + "Number of messages that failed to get converted to storage API messages", this), + sendCommandLatency("sendcommandlatency", "", "Average ms used to send commands to MBUS", this), + sendReplyLatency("sendreplylatency", "", "Average ms used to send replies to MBUS", this) +{ +} + +CommunicationManagerMetrics::~CommunicationManagerMetrics() { } + +} + diff --git a/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h index 4b580f79904..40c3646647e 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h +++ b/storage/src/vespa/storage/storageserver/communicationmanagermetrics.h @@ -9,7 +9,6 @@ #pragma once #include <vespa/metrics/metrics.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { @@ -22,34 +21,8 @@ struct CommunicationManagerMetrics : public metrics::MetricSet { metrics::DoubleAverageMetric sendCommandLatency; metrics::DoubleAverageMetric sendReplyLatency; - CommunicationManagerMetrics(const metrics::LoadTypeSet& loadTypes, - metrics::MetricSet* owner = 0) - : metrics::MetricSet("communication", "", - "Metrics for the communication manager", owner), - queueSize("messagequeue", "", "Size of input message queue.", this), - messageProcessTime(loadTypes, metrics::DoubleAverageMetric( - "messageprocesstime", "", - "Time transport thread uses to process a single message"), - this), - exceptionMessageProcessTime(loadTypes, metrics::DoubleAverageMetric( - "exceptionmessageprocesstime", "", - "Time transport thread uses to process a single message " - "that fails with an exception thrown into communication " - "manager"), - this), - failedDueToTooLittleMemory("toolittlememory", "", - "Number of messages failed due to too little memory " - "available", this), - convertToStorageAPIFailures("convertfailures", "", - "Number of messages that failed to get converted to " - "storage API messages", this), - sendCommandLatency("sendcommandlatency", "", - "Average ms used to send commands to MBUS", this), - sendReplyLatency("sendreplylatency", "", - "Average ms used to send replies to MBUS", this) - { - } - + CommunicationManagerMetrics(const metrics::LoadTypeSet& loadTypes, metrics::MetricSet* owner = 0); + ~CommunicationManagerMetrics(); }; } diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index 03792d8fb56..31fe8fe7878 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -8,9 +8,9 @@ #pragma once +#include "distributornodecontext.h" +#include "storagenode.h" #include <vespa/storage/common/distributorcomponent.h> -#include <vespa/storage/storageserver/distributornodecontext.h> -#include <vespa/storage/storageserver/storagenode.h> #include <vespa/storageframework/generic/thread/tickingthread.h> namespace storage { @@ -41,19 +41,16 @@ public: StorageLink::UP communicationManager = StorageLink::UP()); ~DistributorNode(); - virtual const lib::NodeType& getNodeType() const override - { return lib::NodeType::DISTRIBUTOR; } - - virtual ResumeGuard pause() override; + const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; } + ResumeGuard pause() override; void handleConfigChange(vespa::config::content::core::StorDistributormanagerConfig&); void handleConfigChange(vespa::config::content::core::StorVisitordispatcherConfig&); private: - virtual void initializeNodeSpecific() override; - virtual StorageLink::UP createChain() override; - - virtual api::Timestamp getUniqueTimestamp() override; + void initializeNodeSpecific() override; + StorageLink::UP createChain() override; + api::Timestamp getUniqueTimestamp() override; /** * Shut down necessary distributor-specific components before shutting @@ -63,4 +60,3 @@ private: }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index ebfa10fe814..577fedb58e1 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -1,15 +1,12 @@ // 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/mergethrottler.h> - +#include "mergethrottler.h" +#include "storagemetricsset.h" #include <iostream> #include <sstream> -#include <iterator> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/storage/common/nodestateupdater.h> #include <vespa/storage/persistence/messages.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/log/log.h> LOG_SETUP(".mergethrottler"); @@ -46,6 +43,71 @@ const mbus::string DummyMbusMessage<Base>::NAME = "SkyNet"; } +MergeThrottler::ChainedMergeState::ChainedMergeState() + : _cmd(), + _cmdString(), + _clusterStateVersion(0), + _inCycle(false), + _executingLocally(false), + _unwinding(false), + _cycleBroken(false), + _aborted(false) +{ } + +MergeThrottler::ChainedMergeState::ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing) + : _cmd(cmd), + _cmdString(cmd->toString()), + _clusterStateVersion(static_cast<const api::MergeBucketCommand&>(*cmd).getClusterStateVersion()), + _inCycle(false), + _executingLocally(executing), + _unwinding(false), + _cycleBroken(false), + _aborted(false) +{ } +MergeThrottler::ChainedMergeState::~ChainedMergeState() {} + +MergeThrottler::Metrics::Metrics(metrics::MetricSet* owner) + : metrics::MetricSet("mergethrottler", "", "", owner), + averageQueueWaitingTime("averagequeuewaitingtime", "", "Average time a merge spends in the throttler queue", this), + chaining("mergechains", this), + local("locallyexecutedmerges", this) +{ } +MergeThrottler::Metrics::~Metrics() {} + +MergeThrottler::MergeFailureMetrics::MergeFailureMetrics(metrics::MetricSet* owner) + : metrics::MetricSet("failures", "", "Detailed failure statistics", owner), + sum("total", "", "Sum of all failures", this), + notready("notready", "", "The number of merges discarded because distributor was not ready", this), + timeout("timeout", "", "The number of merges that failed because they timed out towards storage", this), + aborted("aborted", "", "The number of merges that failed because the storage node was (most likely) shutting down", this), + wrongdistribution("wrongdistribution", "", "The number of merges that were discarded (flushed) because they were initiated at an older cluster state than the current", this), + bucketnotfound("bucketnotfound", "", "The number of operations that failed because the bucket did not exist", this), + busy("busy", "", "The number of merges that failed because the storage node was busy", this), + exists("exists", "", "The number of merges that were rejected due to a merge operation for their bucket already being processed", this), + rejected("rejected", "", "The number of merges that were rejected", this), + other("other", "", "The number of other failures", this) +{ + sum.addMetricToSum(notready); + sum.addMetricToSum(timeout); + sum.addMetricToSum(aborted); + sum.addMetricToSum(wrongdistribution); + sum.addMetricToSum(bucketnotfound); + sum.addMetricToSum(busy); + sum.addMetricToSum(exists); + sum.addMetricToSum(rejected); + sum.addMetricToSum(other); +} +MergeThrottler::MergeFailureMetrics::~MergeFailureMetrics() { } + + +MergeThrottler::MergeOperationMetrics::MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner) + : metrics::MetricSet(name, "", vespalib::make_string("Statistics for %s", name.c_str()), owner), + ok("ok", "", vespalib::make_string("The number of successful merges for '%s'", name.c_str()), this), + failures(this) +{ +} +MergeThrottler::MergeOperationMetrics::~MergeOperationMetrics() { } + MergeThrottler::MergeNodeSequence::MergeNodeSequence( const api::MergeBucketCommand& cmd, uint16_t thisIndex) diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.h b/storage/src/vespa/storage/storageserver/mergethrottler.h index 8ee4ca7be71..74ffe095d7c 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.h +++ b/storage/src/vespa/storage/storageserver/mergethrottler.h @@ -7,11 +7,6 @@ */ #pragma once -#include <map> -#include <utility> -#include <vector> -#include <set> -#include <memory> #include <vespa/vespalib/util/document_runnable.h> #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/common/storagelink.h> @@ -48,37 +43,8 @@ public: metrics::LongCountMetric rejected; metrics::LongCountMetric other; - MergeFailureMetrics(metrics::MetricSet* owner) - : metrics::MetricSet("failures", "", "Detailed failure statistics", owner), - sum("total", "", "Sum of all failures", this), - notready("notready", "", "The number of merges discarded " - "because distributor was not ready", this), - timeout("timeout", "", "The number of merges that failed because " - "they timed out towards storage", this), - aborted("aborted", "", "The number of merges that failed " - "because the storage node was (most likely) shutting down", this), - wrongdistribution("wrongdistribution", "", "The number of merges that " - "were discarded (flushed) because they were initiated at an " - "older cluster state than the current", this), - bucketnotfound("bucketnotfound", "", "The number of operations that failed " - "because the bucket did not exist", this), - busy("busy", "", "The number of merges that failed because the " - "storage node was busy", this), - exists("exists", "", "The number of merges that were rejected due to a " - "merge operation for their bucket already being processed", this), - rejected("rejected", "", "The number of merges that were rejected", this), - other("other", "", "The number of other failures", this) - { - sum.addMetricToSum(notready); - sum.addMetricToSum(timeout); - sum.addMetricToSum(aborted); - sum.addMetricToSum(wrongdistribution); - sum.addMetricToSum(bucketnotfound); - sum.addMetricToSum(busy); - sum.addMetricToSum(exists); - sum.addMetricToSum(rejected); - sum.addMetricToSum(other); - } + MergeFailureMetrics(metrics::MetricSet* owner); + ~MergeFailureMetrics(); }; class MergeOperationMetrics : public metrics::MetricSet @@ -87,12 +53,8 @@ public: metrics::LongCountMetric ok; MergeFailureMetrics failures; - MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner) - : metrics::MetricSet(name, "", vespalib::make_string("Statistics for %s", name.c_str()), owner), - ok("ok", "", vespalib::make_string("The number of successful merges for '%s'", name.c_str()), this), - failures(this) - { - } + MergeOperationMetrics(const std::string& name, metrics::MetricSet* owner); + ~MergeOperationMetrics(); }; class Metrics : public metrics::MetricSet @@ -102,15 +64,8 @@ public: MergeOperationMetrics chaining; MergeOperationMetrics local; - Metrics(metrics::MetricSet* owner = 0) - : metrics::MetricSet("mergethrottler", "", "", owner), - averageQueueWaitingTime( - "averagequeuewaitingtime", "", "Average time a merge spends in " - "the throttler queue", this), - chaining("mergechains", this), - local("locallyexecutedmerges", this) - { - } + Metrics(metrics::MetricSet* owner = 0); + ~Metrics(); }; private: @@ -151,30 +106,9 @@ private: bool _cycleBroken; bool _aborted; - ChainedMergeState() - : _cmd(), - _cmdString(), - _clusterStateVersion(0), - _inCycle(false), - _executingLocally(false), - _unwinding(false), - _cycleBroken(false), - _aborted(false) - { - } - - ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing = false) - : _cmd(cmd), - _cmdString(cmd->toString()), - _clusterStateVersion(static_cast<const api::MergeBucketCommand&>( - *cmd).getClusterStateVersion()), - _inCycle(false), - _executingLocally(executing), - _unwinding(false), - _cycleBroken(false), - _aborted(false) - { - } + ChainedMergeState(); + ChainedMergeState(const api::StorageMessage::SP& cmd, bool executing = false); + ~ChainedMergeState(); // Use default copy-constructor/assignment operator bool isExecutingLocally() const { return _executingLocally; } @@ -239,9 +173,7 @@ public: * windowSizeIncrement used for allowing unit tests to start out with more * than 1 as their window size. */ - MergeThrottler(const config::ConfigUri & configUri, - StorageComponentRegister&); - + MergeThrottler(const config::ConfigUri & configUri, StorageComponentRegister&); ~MergeThrottler(); /** Implements document::Runnable::run */ @@ -267,12 +199,8 @@ public: vespalib::Lock& getStateLock() { return _stateLock; } Metrics& getMetrics() { return *_metrics; } - std::size_t getMaxQueueSize() const { return _maxQueueSize; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - // HtmlStatusReporter implementation void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; private: friend class ThreadRendezvousGuard; // impl in .cpp file @@ -285,9 +213,7 @@ private: std::size_t _sortedIndex; // Index of current storage node in the sorted node sequence const uint16_t _thisIndex; // Index of the current storage node - MergeNodeSequence( - const api::MergeBucketCommand& cmd, - uint16_t thisIndex); + MergeNodeSequence(const api::MergeBucketCommand& cmd, uint16_t thisIndex); std::size_t getSortedIndex() const { return _sortedIndex; } const std::vector<api::MergeBucketCommand::Node>& getSortedNodes() const { @@ -332,13 +258,8 @@ private: // NOTE: unless explicitly specified, all the below functions require // _sync lock to be held upon call (usually implicitly via MessageGuard) - void handleMessageDown( - const std::shared_ptr<api::StorageMessage>& msg, - MessageGuard& msgGuard); - - void handleMessageUp( - const std::shared_ptr<api::StorageMessage>& msg, - MessageGuard& msgGuard); + void handleMessageDown(const std::shared_ptr<api::StorageMessage>& msg, MessageGuard& msgGuard); + void handleMessageUp(const std::shared_ptr<api::StorageMessage>& msg, MessageGuard& msgGuard); /** * Handle the receival of MergeBucketReply, be it from another node @@ -372,17 +293,13 @@ private: * * Precondition: no existing merge state exists for msg's bucketid. */ - void processNewMergeCommand( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + void processNewMergeCommand(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * Precondition: an existing merge state exists for msg's bucketid. * @return true if message was handled, false otherwise (see onUp/onDown). */ - bool processCycledMergeCommand( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + bool processCycledMergeCommand(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * Forwards the given MergeBucketCommand to the storage node given @@ -403,10 +320,7 @@ private: * @return Highest priority waiting merge or null SP if queue is empty */ api::StorageMessage::SP getNextQueuedMerge(); - - void enqueueMerge( - const api::StorageMessage::SP& msg, - MessageGuard& msgGuard); + void enqueueMerge(const api::StorageMessage::SP& msg, MessageGuard& msgGuard); /** * @return true if throttle policy says at least one additional @@ -434,25 +348,15 @@ private: * Immediately reject all queued merges whose cluster state version is * less than that of rejectLessThanVersion */ - void rejectOutdatedQueuedMerges(MessageGuard& msgGuard, - uint32_t rejectLessThanVersion); - + void rejectOutdatedQueuedMerges(MessageGuard& msgGuard, uint32_t rejectLessThanVersion); bool attemptProcessNextQueuedMerge(MessageGuard& msgGuard); - bool processQueuedMerges(MessageGuard& msgGuard); - void handleRendezvous(vespalib::MonitorGuard& guard); - void rendezvousWithWorkerThread(vespalib::MonitorGuard&); - void releaseWorkerThreadRendezvous(vespalib::MonitorGuard&); - bool isDiffCommand(const api::StorageMessage& msg) const; - bool isMergeCommand(const api::StorageMessage& msg) const; - bool isMergeReply(const api::StorageMessage& msg) const; - bool bucketIsUnknownOrAborted(const document::BucketId& bucket) const; std::shared_ptr<api::StorageMessage> makeAbortReply( @@ -460,8 +364,7 @@ private: vespalib::stringref reason) const; void handleOutdatedMerges(const api::SetSystemStateCommand&); - void rejectOperationsInThreadQueue(MessageGuard&, - uint32_t minimumStateVersion); + void rejectOperationsInThreadQueue(MessageGuard&, uint32_t minimumStateVersion); void markActiveMergesAsAborted(uint32_t minimumStateVersion); // const function, but metrics are mutable @@ -471,4 +374,3 @@ private: }; } // namespace storage - diff --git a/storage/src/vespa/storage/storageserver/opslogger.h b/storage/src/vespa/storage/storageserver/opslogger.h index 57f304a04aa..905c0fd4e85 100644 --- a/storage/src/vespa/storage/storageserver/opslogger.h +++ b/storage/src/vespa/storage/storageserver/opslogger.h @@ -27,20 +27,15 @@ public: ~OpsLogger(); void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool onPutReply(const std::shared_ptr<api::PutReply>& msg) override; bool onUpdateReply(const std::shared_ptr<api::UpdateReply>& msg) override; bool onRemoveReply(const std::shared_ptr<api::RemoveReply>& msg) override; bool onGetReply(const std::shared_ptr<api::GetReply>& msg) override; /** Ignore all replies on the way down the storage chain. */ - bool onDown(const std::shared_ptr<api::StorageMessage>&) override - { return false; }; - + bool onDown(const std::shared_ptr<api::StorageMessage>&) override { return false; }; void configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config) override; - private: vespalib::Lock _lock; std::string _fileName; @@ -51,4 +46,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h index 028168937b5..974b8ca2393 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.h +++ b/storage/src/vespa/storage/storageserver/statemanager.h @@ -72,23 +72,19 @@ public: void tick(); - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - /** Implementation of HtmlStatusReporter */ - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + lib::NodeState::CSP getReportedNodeState() const override; + lib::NodeState::CSP getCurrentNodeState() const override; + lib::ClusterState::CSP getSystemState() const override; - virtual lib::NodeState::CSP getReportedNodeState() const override; - virtual lib::NodeState::CSP getCurrentNodeState() const override; - virtual lib::ClusterState::CSP getSystemState() const override; - - virtual void addStateListener(StateListener&) override; - virtual void removeStateListener(StateListener&) override; - - virtual Lock::SP grabStateChangeLock() override; - virtual void setReportedNodeState(const lib::NodeState& state) override; + void addStateListener(StateListener&) override; + void removeStateListener(StateListener&) override; + Lock::SP grabStateChangeLock() override; + void setReportedNodeState(const lib::NodeState& state) override; void setClusterState(const lib::ClusterState& c); - HostInfo& getHostInfo() { return *_hostInfo; } private: @@ -136,10 +132,7 @@ private: */ std::string getNodeInfo() const; - virtual void run(framework::ThreadHandle&) override; - + void run(framework::ThreadHandle&) override; }; } // storage - - diff --git a/storage/src/vespa/storage/storageserver/statereporter.h b/storage/src/vespa/storage/storageserver/statereporter.h index 51a9e93a197..c46a878ef40 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.h +++ b/storage/src/vespa/storage/storageserver/statereporter.h @@ -10,11 +10,11 @@ #pragma once -#include <vespa/metrics/metrics.h> -#include <vespa/metrics/state_api_adapter.h> +#include "applicationgenerationfetcher.h" #include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/storageserver/applicationgenerationfetcher.h> #include <vespa/storageframework/storageframework.h> +#include <vespa/metrics/metrics.h> +#include <vespa/metrics/state_api_adapter.h> #include <vespa/vespalib/net/metrics_producer.h> #include <vespa/vespalib/net/state_api.h> @@ -37,11 +37,8 @@ public: const std::string& name = "status"); ~StateReporter(); - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const override; - bool reportStatus(std::ostream& out, - const framework::HttpUrlPath& path) const override; - + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream& out, const framework::HttpUrlPath& path) const override; private: metrics::MetricManager &_manager; metrics::StateApiAdapter _metricsAdapter; @@ -50,16 +47,10 @@ private: ApplicationGenerationFetcher& _generationFetcher; std::string _name; - // Implements vespalib::MetricsProducer - virtual vespalib::string getMetrics(const vespalib::string &consumer) override; - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override; - - // Implements vespalib::HealthProducer - virtual Health getHealth() const override; - - // Implements vespalib::ComponentConfigProducer - virtual void getComponentConfig(Consumer &consumer) override; + vespalib::string getMetrics(const vespalib::string &consumer) override; + vespalib::string getTotalMetrics(const vespalib::string &consumer) override; + Health getHealth() const override; + void getComponentConfig(Consumer &consumer) override; }; } // storage - diff --git a/storage/src/vespa/storage/storageserver/storagemetricsset.cpp b/storage/src/vespa/storage/storageserver/storagemetricsset.cpp new file mode 100644 index 00000000000..aa57e3ebcd5 --- /dev/null +++ b/storage/src/vespa/storage/storageserver/storagemetricsset.cpp @@ -0,0 +1,77 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "storagemetricsset.h" +#include <vespa/document/fieldvalue/serializablearray.h> + +namespace storage { + +MessageMemoryUseMetricSet::MessageMemoryUseMetricSet(metrics::MetricSet* owner) + : metrics::MetricSet("message_memory_use", "memory", "Message use from storage messages", owner), + total("total", "memory", "Message use from storage messages", this), + lowpri("lowpri", "memory", "Message use from low priority storage messages", this), + normalpri("normalpri", "memory", "Message use from normal priority storage messages", this), + highpri("highpri", "memory", "Message use from high priority storage messages", this), + veryhighpri("veryhighpri", "memory", "Message use from very high priority storage messages", this) +{ } +MessageMemoryUseMetricSet::~MessageMemoryUseMetricSet() {} + +DocumentSerializationMetricSet::DocumentSerializationMetricSet(metrics::MetricSet* owner) + : metrics::MetricSet("document_serialization", "docserialization", + "Counts of document serialization of various types", owner), + usedCachedSerializationCount( + "cached_serialization_count", "docserialization", + "Number of times we didn't need to serialize the document as " + "we already had serialized version cached", this), + compressedDocumentCount( + "compressed_serialization_count", "docserialization", + "Number of times we compressed document when serializing", + this), + compressionDidntHelpCount( + "compressed_didnthelp_count", "docserialization", + "Number of times we compressed document when serializing, but " + "the compressed version was bigger, so it was dumped", this), + uncompressableCount( + "uncompressable_serialization_count", "docserialization", + "Number of times we didn't attempt compression as document " + "had already been tagged uncompressable", this), + serializedUncompressed( + "uncompressed_serialization_count", "docserialization", + "Number of times we serialized a document uncompressed", this), + inputWronglySerialized( + "input_wrongly_serialized_count", "docserialization", + "Number of times we reserialized a document because the " + "compression it had in cache did not match what was configured", + this) +{ } +DocumentSerializationMetricSet::~DocumentSerializationMetricSet() { } + +StorageMetricSet::StorageMetricSet() + : metrics::MetricSet("server", "memory", + "Metrics for VDS applications"), + memoryUse("memoryusage", "memory", "", this), + memoryUse_messages(this), + memoryUse_visiting("memoryusage_visiting", "memory", + "Message use from visiting", this), + documentSerialization(this) +{ } +StorageMetricSet::~StorageMetricSet() { } + +void StorageMetricSet::updateMetrics() { + document::SerializableArray::Statistics stats( + document::SerializableArray::getStatistics()); + + documentSerialization.usedCachedSerializationCount.set( + stats._usedCachedSerializationCount); + documentSerialization.compressedDocumentCount.set( + stats._compressedDocumentCount); + documentSerialization.compressionDidntHelpCount.set( + stats._compressionDidntHelpCount); + documentSerialization.uncompressableCount.set( + stats._uncompressableCount); + documentSerialization.serializedUncompressed.set( + stats._serializedUncompressed); + documentSerialization.inputWronglySerialized.set( + stats._inputWronglySerialized); +} + +} // storage diff --git a/storage/src/vespa/storage/storageserver/storagemetricsset.h b/storage/src/vespa/storage/storageserver/storagemetricsset.h index 18be3e21ada..f7083705763 100644 --- a/storage/src/vespa/storage/storageserver/storagemetricsset.h +++ b/storage/src/vespa/storage/storageserver/storagemetricsset.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/metrics/metrics.h> -#include <vespa/document/fieldvalue/serializablearray.h> namespace storage { @@ -16,22 +15,8 @@ public: metrics::LongValueMetric highpri; metrics::LongValueMetric veryhighpri; - MessageMemoryUseMetricSet(metrics::MetricSet* owner) - : metrics::MetricSet("message_memory_use", "memory", - "Message use from storage messages", owner), - total("total", "memory", - "Message use from storage messages", this), - lowpri("lowpri", "memory", - "Message use from low priority storage messages", this), - normalpri("normalpri", "memory", - "Message use from normal priority storage messages", this), - highpri("highpri", "memory", - "Message use from high priority storage messages", this), - veryhighpri("veryhighpri", "memory", - "Message use from very high priority storage messages", this) - { - } - + MessageMemoryUseMetricSet(metrics::MetricSet* owner); + ~MessageMemoryUseMetricSet(); }; struct DocumentSerializationMetricSet : public metrics::MetricSet @@ -43,36 +28,8 @@ struct DocumentSerializationMetricSet : public metrics::MetricSet metrics::LongCountMetric serializedUncompressed; metrics::LongCountMetric inputWronglySerialized; - DocumentSerializationMetricSet(metrics::MetricSet* owner) - : metrics::MetricSet("document_serialization", "docserialization", - "Counts of document serialization of various types", owner), - usedCachedSerializationCount( - "cached_serialization_count", "docserialization", - "Number of times we didn't need to serialize the document as " - "we already had serialized version cached", this), - compressedDocumentCount( - "compressed_serialization_count", "docserialization", - "Number of times we compressed document when serializing", - this), - compressionDidntHelpCount( - "compressed_didnthelp_count", "docserialization", - "Number of times we compressed document when serializing, but " - "the compressed version was bigger, so it was dumped", this), - uncompressableCount( - "uncompressable_serialization_count", "docserialization", - "Number of times we didn't attempt compression as document " - "had already been tagged uncompressable", this), - serializedUncompressed( - "uncompressed_serialization_count", "docserialization", - "Number of times we serialized a document uncompressed", this), - inputWronglySerialized( - "input_wrongly_serialized_count", "docserialization", - "Number of times we reserialized a document because the " - "compression it had in cache did not match what was configured", - this) - { - } - + DocumentSerializationMetricSet(metrics::MetricSet* owner); + ~DocumentSerializationMetricSet(); }; struct StorageMetricSet : public metrics::MetricSet @@ -82,34 +39,9 @@ struct StorageMetricSet : public metrics::MetricSet metrics::LongValueMetric memoryUse_visiting; DocumentSerializationMetricSet documentSerialization; - StorageMetricSet() - : metrics::MetricSet("server", "memory", - "Metrics for VDS applications"), - memoryUse("memoryusage", "memory", "", this), - memoryUse_messages(this), - memoryUse_visiting("memoryusage_visiting", "memory", - "Message use from visiting", this), - documentSerialization(this) - { - } - - void updateMetrics() { - document::SerializableArray::Statistics stats( - document::SerializableArray::getStatistics()); - - documentSerialization.usedCachedSerializationCount.set( - stats._usedCachedSerializationCount); - documentSerialization.compressedDocumentCount.set( - stats._compressedDocumentCount); - documentSerialization.compressionDidntHelpCount.set( - stats._compressionDidntHelpCount); - documentSerialization.uncompressableCount.set( - stats._uncompressableCount); - documentSerialization.serializedUncompressed.set( - stats._serializedUncompressed); - documentSerialization.inputWronglySerialized.set( - stats._inputWronglySerialized); - } + StorageMetricSet(); + ~StorageMetricSet(); + void updateMetrics(); }; } // storage diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index 5df29191489..5eea62a17ad 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -12,9 +12,10 @@ #pragma once +#include "storagemetricsset.h" +#include "storagenodecontext.h" +#include "applicationgenerationfetcher.h" #include <vespa/document/bucket/bucketidfactory.h> -#include <memory> -#include <string> #include <vespa/storage/config/config-stor-server.h> #include <vespa/config/helper/legacysubscriber.h> @@ -34,9 +35,6 @@ #include <vespa/storageframework/defaultimplementation/memory/memorymanager.h> #include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h> #include <vespa/storage/frameworkimpl/memory/memorystatusviewer.h> -#include <vespa/storage/storageserver/applicationgenerationfetcher.h> -#include <vespa/storage/storageserver/storagenodecontext.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storage/visiting/visitormessagesessionfactory.h> #include <vespa/storageframework/storageframework.h> #include <vespa/storage/storageutil/resumeguard.h> @@ -78,12 +76,9 @@ public: virtual ~StorageNode(); virtual const lib::NodeType& getNodeType() const = 0; - bool attemptedStopped() const; - - virtual void notifyDoneInitializing() override; + void notifyDoneInitializing() override; void waitUntilInitialized(uint32_t timeoutSeconds = 15); - void updateMetrics(const MetricLockGuard & guard) override; /** Updates the document type repo. */ @@ -94,17 +89,12 @@ public: * is alive, no calls will be made towards the persistence provider. */ virtual ResumeGuard pause() = 0; - void requestShutdown(vespalib::stringref reason) override; - - void - notifyPartitionDown(int partId, vespalib::stringref reason); - + void notifyPartitionDown(int partId, vespalib::stringref reason); DoneInitializeHandler& getDoneInitializeHandler() { return *this; } - // For testing + // For testing StorageLink* getChain() { return _chain.get(); } - virtual void initializeStatusWebServer(); private: @@ -140,10 +130,10 @@ private: std::unique_ptr<StorageLink> _chain; /** Implementation of config callbacks. */ - virtual void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config) override; - virtual void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>) override; + void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>) override; virtual void configure(std::unique_ptr<document::DocumenttypesConfig> config, bool hasChanged, int64_t generation); void updateUpgradeFlag(const vespa::config::content::UpgradingConfig&); @@ -184,8 +174,6 @@ protected: virtual void handleLiveConfigUpdate(); void shutdown(); virtual void removeConfigSubscriptions(); - }; } // storage - diff --git a/storage/src/vespa/storage/storageutil/palette.h b/storage/src/vespa/storage/storageutil/palette.h index fe42eae0d31..338d8a3add7 100644 --- a/storage/src/vespa/storage/storageutil/palette.h +++ b/storage/src/vespa/storage/storageutil/palette.h @@ -11,6 +11,8 @@ #pragma once #include <vector> +#include <cstdint> +#include <iosfwd> namespace storage { diff --git a/storage/src/vespa/storage/tools/throttlingsim.h b/storage/src/vespa/storage/tools/throttlingsim.h index b583a7d2533..a7384d0f362 100644 --- a/storage/src/vespa/storage/tools/throttlingsim.h +++ b/storage/src/vespa/storage/tools/throttlingsim.h @@ -75,7 +75,7 @@ public: double max_diff; virtual void returnMessage(const Message& m) = 0; - virtual void run() override; + void run() override; virtual void print(double timenow); Client(Messaging& msgng, double windowSize, int to); @@ -91,17 +91,15 @@ class FixedClient : public Client { public: FixedClient(Messaging& msgng, int winsize, int to) : Client(msgng, winsize, to) {}; - - virtual void returnMessage(const Message& m) override; + void returnMessage(const Message& m) override; }; class LoadBalancingClient : public Client { public: LoadBalancingClient(Messaging& msgng, int winsize, int to); - - virtual void returnMessage(const Message& m) override; - virtual void run() override; - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void run() override; + void print(double timenow) override; std::vector<double> weights; }; @@ -109,10 +107,9 @@ public: class BusyCounterBalancingClient : public Client { public: BusyCounterBalancingClient(Messaging& msgng, int winsize, int to); - - virtual void returnMessage(const Message& m) override; - virtual void run() override; - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void run() override; + void print(double timenow) override; std::vector<int> busyCount; }; @@ -126,8 +123,7 @@ public: DynamicClient(Messaging& msgng, int maxWinSize, double to) : Client(msgng, 1, static_cast<int>(to)), maxwinsize(maxWinSize), threshold(maxWinSize / 2), lastFailTimestamp(0) {}; - - virtual void returnMessage(const Message& m) override; + void returnMessage(const Message& m) override; }; class LatencyControlClient : public Client { @@ -137,10 +133,8 @@ public: LatencyControlClient(Messaging& msgng, double to) : Client(msgng, 1, static_cast<int>(to)), count(0){}; - - virtual void returnMessage(const Message& m) override; - - virtual void print(double timenow) override; + void returnMessage(const Message& m) override; + void print(double timenow) override; }; @@ -154,5 +148,4 @@ public: ThrottlingApp() {}; int Main() override; - }; diff --git a/storage/src/vespa/storage/visiting/commandqueue.h b/storage/src/vespa/storage/visiting/commandqueue.h index 07677fdcd38..ba0141add45 100644 --- a/storage/src/vespa/storage/visiting/commandqueue.h +++ b/storage/src/vespa/storage/visiting/commandqueue.h @@ -22,229 +22,189 @@ namespace storage { - template<class Command> - class CommandQueue : public vespalib::Printable - { - public: - struct CommandEntry { - typedef typename Command::Priority PriorityType; - std::shared_ptr<Command> _command; - uint64_t _time; - uint64_t _sequenceId; - PriorityType _priority; - - CommandEntry(const std::shared_ptr<Command>& cmd, - uint64_t time, - uint64_t sequenceId, - PriorityType priority) - : _command(cmd), _time(time), _sequenceId(sequenceId), _priority(priority) - {} - - // Sort on both priority and sequence ID - bool operator<(const CommandEntry& entry) const { - if (_priority != entry._priority) { - return (_priority < entry._priority); - } - return (_sequenceId < entry._sequenceId); - } - }; - - private: - typedef boost::multi_index::multi_index_container< - CommandEntry, - boost::multi_index::indexed_by< - boost::multi_index::ordered_unique< - boost::multi_index::identity<CommandEntry> - >, - boost::multi_index::ordered_non_unique< - boost::multi_index::member<CommandEntry, uint64_t, &CommandEntry::_time> - > - > - > CommandList; - typedef typename boost::multi_index - ::nth_index<CommandList, 1>::type timelist; - - framework::Clock& _clock; - mutable CommandList _commands; +template<class Command> +class CommandQueue : public vespalib::Printable +{ +public: + struct CommandEntry { + typedef typename Command::Priority PriorityType; + std::shared_ptr<Command> _command; + uint64_t _time; uint64_t _sequenceId; - - public: - typedef typename CommandList::iterator iterator; - typedef typename CommandList::reverse_iterator reverse_iterator; - typedef typename CommandList::const_iterator const_iterator; - typedef typename CommandList::const_reverse_iterator const_reverse_iterator; - typedef typename timelist::const_iterator const_titerator; - - CommandQueue(framework::Clock& clock) - : _clock(clock), - _sequenceId(0) {} - - const framework::Clock& getTimer() const { return _clock; } - - iterator begin() { return _commands.begin(); } - iterator end() { return _commands.end(); } - - const_iterator begin() const { return _commands.begin(); } - const_iterator end() const { return _commands.end(); } - - const_titerator tbegin() const { - timelist& tl = boost::multi_index::get<1>(_commands); - return tl.begin(); - } - const_titerator tend() const { - timelist& tl = boost::multi_index::get<1>(_commands); - return tl.end(); + PriorityType _priority; + + CommandEntry(const std::shared_ptr<Command>& cmd, + uint64_t time, + uint64_t sequenceId, + PriorityType priority) + : _command(cmd), _time(time), _sequenceId(sequenceId), _priority(priority) + {} + + // Sort on both priority and sequence ID + bool operator<(const CommandEntry& entry) const { + if (_priority != entry._priority) { + return (_priority < entry._priority); + } + return (_sequenceId < entry._sequenceId); } + }; - bool empty() const; - - uint32_t size() const; - - std::pair<std::shared_ptr<Command>, time_t> releaseNextCommand(); - - std::shared_ptr<Command> peekNextCommand() const; - - void add(const std::shared_ptr<Command>& msg); +private: + typedef boost::multi_index::multi_index_container< + CommandEntry, + boost::multi_index::indexed_by< + boost::multi_index::ordered_unique< + boost::multi_index::identity<CommandEntry> + >, + boost::multi_index::ordered_non_unique< + boost::multi_index::member<CommandEntry, uint64_t, &CommandEntry::_time> + > + > + > CommandList; + typedef typename boost::multi_index + ::nth_index<CommandList, 1>::type timelist; - void erase(iterator it); + framework::Clock& _clock; + mutable CommandList _commands; + uint64_t _sequenceId; - std::list<CommandEntry> releaseTimedOut(); +public: + typedef typename CommandList::iterator iterator; + typedef typename CommandList::reverse_iterator reverse_iterator; + typedef typename CommandList::const_iterator const_iterator; + typedef typename CommandList::const_reverse_iterator const_reverse_iterator; + typedef typename timelist::const_iterator const_titerator; - std::pair<std::shared_ptr<Command>, time_t> - releaseLowestPriorityCommand(); + CommandQueue(framework::Clock& clock) + : _clock(clock), + _sequenceId(0) {} - std::shared_ptr<Command> peekLowestPriorityCommand() const; + const framework::Clock& getTimer() const { return _clock; } - void clear(); + iterator begin() { return _commands.begin(); } + iterator end() { return _commands.end(); } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; - }; + const_iterator begin() const { return _commands.begin(); } + const_iterator end() const { return _commands.end(); } - template<class Command> - inline bool - CommandQueue<Command>::empty() const - { - return _commands.empty(); + const_titerator tbegin() const { + timelist& tl = boost::multi_index::get<1>(_commands); + return tl.begin(); } - - template<class Command> - inline uint32_t - CommandQueue<Command>::size() const - { - return _commands.size(); + const_titerator tend() const { + timelist& tl = boost::multi_index::get<1>(_commands); + return tl.end(); } - template<class Command> - inline std::pair<std::shared_ptr<Command>, time_t> - CommandQueue<Command>::releaseNextCommand() - { - std::pair<std::shared_ptr<Command>, time_t> retVal( - std::shared_ptr<Command>(), 0); - if (!_commands.empty()) { - iterator first = _commands.begin(); - retVal.first = first->_command; - retVal.second = first->_time; - _commands.erase(first); - } - return retVal; + bool empty() const { return _commands.empty(); } + uint32_t size() const { return _commands.size(); } + std::pair<std::shared_ptr<Command>, time_t> releaseNextCommand(); + std::shared_ptr<Command> peekNextCommand() const; + void add(const std::shared_ptr<Command>& msg); + void erase(iterator it) { _commands.erase(it); } + std::list<CommandEntry> releaseTimedOut(); + std::pair<std::shared_ptr<Command>, time_t> releaseLowestPriorityCommand(); + + std::shared_ptr<Command> peekLowestPriorityCommand() const; + void clear() { return _commands.clear(); } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; +}; + + +template<class Command> +std::pair<std::shared_ptr<Command>, time_t> +CommandQueue<Command>::releaseNextCommand() +{ + std::pair<std::shared_ptr<Command>, time_t> retVal( + std::shared_ptr<Command>(), 0); + if (!_commands.empty()) { + iterator first = _commands.begin(); + retVal.first = first->_command; + retVal.second = first->_time; + _commands.erase(first); } - - template<class Command> - inline std::shared_ptr<Command> - CommandQueue<Command>::peekNextCommand() const - { - if (!_commands.empty()) { - const_iterator first = _commands.begin(); - return first->_command; - } else { - return std::shared_ptr<Command>(); - } - } - - template<class Command> - inline void - CommandQueue<Command>::add( - const std::shared_ptr<Command>& cmd) - { - framework::MicroSecTime time(_clock.getTimeInMicros() - + framework::MicroSecTime(cmd->getQueueTimeout() * 1000000)); - _commands.insert(CommandEntry(cmd, time.getTime(), ++_sequenceId, cmd->getPriority())); + return retVal; +} + +template<class Command> +std::shared_ptr<Command> +CommandQueue<Command>::peekNextCommand() const +{ + if (!_commands.empty()) { + const_iterator first = _commands.begin(); + return first->_command; + } else { + return std::shared_ptr<Command>(); } - - template<class Command> - inline void - CommandQueue<Command>::erase(iterator it) - { - _commands.erase(it); - } - - template<class Command> - inline std::list<typename CommandQueue<Command>::CommandEntry> - CommandQueue<Command>::releaseTimedOut() - { - std::list<CommandEntry> mylist; - framework::MicroSecTime time(_clock.getTimeInMicros()); - while (!empty() && tbegin()->_time <= time.getTime()) { - mylist.push_back(*tbegin()); - timelist& tl = boost::multi_index::get<1>(_commands); - tl.erase(tbegin()); - } - return mylist; +} + +template<class Command> +void +CommandQueue<Command>::add( + const std::shared_ptr<Command>& cmd) +{ + framework::MicroSecTime time(_clock.getTimeInMicros() + + framework::MicroSecTime(cmd->getQueueTimeout() * 1000000)); + _commands.insert(CommandEntry(cmd, time.getTime(), ++_sequenceId, cmd->getPriority())); +} + +template<class Command> +std::list<typename CommandQueue<Command>::CommandEntry> +CommandQueue<Command>::releaseTimedOut() +{ + std::list<CommandEntry> mylist; + framework::MicroSecTime time(_clock.getTimeInMicros()); + while (!empty() && tbegin()->_time <= time.getTime()) { + mylist.push_back(*tbegin()); + timelist& tl = boost::multi_index::get<1>(_commands); + tl.erase(tbegin()); } - - template <class Command> - inline std::pair<std::shared_ptr<Command>, time_t> - CommandQueue<Command>::releaseLowestPriorityCommand() - { - if (!_commands.empty()) { - iterator last = (++_commands.rbegin()).base(); - time_t time = last->_time; - std::shared_ptr<Command> cmd(last->_command); - _commands.erase(last); - return std::pair<std::shared_ptr<Command>, time_t>(cmd, time); - } else { - return std::pair<std::shared_ptr<Command>, time_t>( - std::shared_ptr<Command>(), 0); - } + return mylist; +} + +template <class Command> +std::pair<std::shared_ptr<Command>, time_t> +CommandQueue<Command>::releaseLowestPriorityCommand() +{ + if (!_commands.empty()) { + iterator last = (++_commands.rbegin()).base(); + time_t time = last->_time; + std::shared_ptr<Command> cmd(last->_command); + _commands.erase(last); + return std::pair<std::shared_ptr<Command>, time_t>(cmd, time); + } else { + return std::pair<std::shared_ptr<Command>, time_t>( + std::shared_ptr<Command>(), 0); } - - template <class Command> - inline std::shared_ptr<Command> - CommandQueue<Command>::peekLowestPriorityCommand() const - { - if (!_commands.empty()) { - const_reverse_iterator last = _commands.rbegin(); - return last->_command; - } else { - return std::shared_ptr<Command>(); - } +} + +template <class Command> +std::shared_ptr<Command> +CommandQueue<Command>::peekLowestPriorityCommand() const +{ + if (!_commands.empty()) { + const_reverse_iterator last = _commands.rbegin(); + return last->_command; + } else { + return std::shared_ptr<Command>(); } - - template<class Command> - inline void - CommandQueue<Command>::clear() - { - _commands.clear(); +} + +template<class Command> +void +CommandQueue<Command>::print(std::ostream& out, bool verbose, const std::string& indent) const +{ + (void) verbose; + out << "Insert order:\n"; + for (const_iterator it = begin(); it != end(); ++it) { + out << indent << *it->_command << ", priority " << it->_priority + << ", time " << it->_time << "\n"; } - - template<class Command> - inline void - CommandQueue<Command>::print(std::ostream& out, bool verbose, - const std::string& indent) const - { - (void) verbose; - out << "Insert order:\n"; - for (const_iterator it = begin(); it != end(); ++it) { - out << indent << *it->_command << ", priority " << it->_priority - << ", time " << it->_time << "\n"; - } - out << indent << "Time order:"; - for (const_titerator it = tbegin(); it != tend(); ++it) { - out << "\n" << indent << *it->_command << ", priority " << it->_priority - << ", time " << it->_time; - } + out << indent << "Time order:"; + for (const_titerator it = tbegin(); it != tend(); ++it) { + out << "\n" << indent << *it->_command << ", priority " << it->_priority + << ", time " << it->_time; } +} } // storage - diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h index ecf51035a03..814cba9501b 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.h +++ b/storage/src/vespa/storage/visiting/countvisitor.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp index a36ace1d427..acafa30ef9d 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp +++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.cpp @@ -3,12 +3,10 @@ #include "dumpvisitorsingle.h" #include <vespa/documentapi/messagebus/messages/multioperationmessage.h> #include <vespa/document/update/documentupdate.h> -#include <vespa/log/log.h> -#include <vespa/vespalib/text/stringtokenizer.h> #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> -#include <memory> +#include <vespa/log/log.h> LOG_SETUP(".visitor.instance.dumpvisitorsingle"); namespace storage { diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h index d7f7b63d851..b0fd4b2b9f0 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h +++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { @@ -19,8 +19,7 @@ public: const vdslib::Parameters& params); private: - void handleDocuments(const document::BucketId&, - std::vector<spi::DocEntry::UP>&, HitCounter&) override; + void handleDocuments(const document::BucketId&, std::vector<spi::DocEntry::UP>&, HitCounter&) override; }; struct DumpVisitorSingleFactory : public VisitorFactory { @@ -31,14 +30,10 @@ struct DumpVisitorSingleFactory : public VisitorFactory { }; Visitor* - makeVisitor(StorageComponent& c, - VisitorEnvironment&, const vdslib::Parameters& params) override - { + + makeVisitor(StorageComponent& c, VisitorEnvironment&, const vdslib::Parameters& params) override { return new DumpVisitorSingle(c, params); } }; } - - - diff --git a/storage/src/vespa/storage/visiting/messages.h b/storage/src/vespa/storage/visiting/messages.h index d646355895f..b79fae0575f 100644 --- a/storage/src/vespa/storage/visiting/messages.h +++ b/storage/src/vespa/storage/visiting/messages.h @@ -29,11 +29,9 @@ public: _config(config) {} std::unique_ptr<api::StorageReply> makeReply() override; - const vespa::config::content::core::StorVisitorConfig& getConfig() const { return _config; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfig()"; if (verbose) { @@ -53,12 +51,8 @@ public: PropagateVisitorConfigReply(const PropagateVisitorConfig& cmd) : api::InternalReply(ID, cmd) - { - } - - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + {} + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfigReply()"; if (verbose) { @@ -76,4 +70,3 @@ PropagateVisitorConfig::makeReply() } } // storage - diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h index dac6996028b..b9f54a5d0ea 100644 --- a/storage/src/vespa/storage/visiting/recoveryvisitor.h +++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h @@ -9,7 +9,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" #include <vespa/storageapi/message/datagram.h> namespace documentapi { diff --git a/storage/src/vespa/storage/visiting/testvisitor.h b/storage/src/vespa/storage/visiting/testvisitor.h index c2740b11d56..db4e1d60939 100644 --- a/storage/src/vespa/storage/visiting/testvisitor.h +++ b/storage/src/vespa/storage/visiting/testvisitor.h @@ -8,7 +8,7 @@ */ #pragma once -#include <vespa/storage/visiting/visitor.h> +#include "visitor.h" namespace storage { @@ -30,10 +30,9 @@ private: } void completedVisiting(HitCounter& hitCounter) override; - void abortedVisiting() override; - // Send datagram with message back to client + // Send datagram with message back to client void report(const std::string& message); std::string _params; @@ -55,6 +54,3 @@ struct TestVisitorFactory : public VisitorFactory { }; } - - - diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index 3d5e9fc2c53..918d2d0e339 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -174,8 +174,7 @@ private: bool hasPendingIterators() const { return _pendingIterators > 0; } - void print(std::ostream& out, bool, const std::string& /*indent*/) const override - { + void print(std::ostream& out, bool, const std::string& ) const override { out << "BucketIterationState(" << _bucketId << ", pending GetIters: " << _pendingIterators diff --git a/storage/src/vespa/storage/visiting/visitormanager.h b/storage/src/vespa/storage/visiting/visitormanager.h index 9b750e3af4f..b966526ad7a 100644 --- a/storage/src/vespa/storage/visiting/visitormanager.h +++ b/storage/src/vespa/storage/visiting/visitormanager.h @@ -19,19 +19,18 @@ #pragma once -#include <vespa/vespalib/util/document_runnable.h> +#include "commandqueue.h" +#include "visitor.h" +#include "visitormetrics.h" +#include "visitorthread.h" +#include "config-stor-visitor.h" +#include <vespa/storageframework/storageframework.h> +#include <vespa/storage/common/storagelink.h> #include <vespa/storageapi/message/datagram.h> #include <vespa/storageapi/message/internal.h> #include <vespa/storageapi/message/visitor.h> -#include <vespa/storage/common/storagelink.h> -#include <vespa/storage/visiting/commandqueue.h> -#include <vespa/storage/visiting/config-stor-visitor.h> -#include <vespa/storage/visiting/visitor.h> -#include <vespa/storage/visiting/visitormetrics.h> -#include <vespa/storage/visiting/visitorthread.h> -#include <vespa/storageframework/storageframework.h> -#include <vespa/storageframework/storageframework.h> #include <vespa/config/config.h> +#include <vespa/vespalib/util/document_runnable.h> namespace storage { namespace api { @@ -90,14 +89,11 @@ public: VisitorManager(const config::ConfigUri & configUri, StorageComponentRegister&, VisitorMessageSessionFactory&, const VisitorFactory::Map& external = VisitorFactory::Map()); - virtual ~VisitorManager(); - - virtual void onClose() override; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + ~VisitorManager(); + void onClose() override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; uint32_t getActiveVisitorCount() const; - void setTimeBetweenTicks(uint32_t time); void setMaxConcurrentVisitors(uint32_t count) { // Used in unit testing @@ -126,7 +122,7 @@ public: private: void configure(std::unique_ptr<vespa::config::content::core::StorVisitorConfig>) override; - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; /** * Schedules a visitor for running. onCreateVisitor will typically call @@ -157,13 +153,12 @@ private: */ bool attemptScheduleQueuedVisitor(vespalib::MonitorGuard& visitorLock); - // VisitorMessageHandler implementation + // VisitorMessageHandler implementation void send(const std::shared_ptr<api::StorageCommand>& cmd, Visitor& visitor) override; void send(const std::shared_ptr<api::StorageReply>& reply) override; void closed(api::VisitorId id) override; - // Status::Reporter implementation - virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; /** * The maximum amount of concurrent visitors for a priority is given @@ -179,4 +174,3 @@ private: }; } - diff --git a/storage/src/vespa/storage/visiting/visitorthread.h b/storage/src/vespa/storage/visiting/visitorthread.h index 2f0a125d6ce..5f9d8897d9f 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.h +++ b/storage/src/vespa/storage/visiting/visitorthread.h @@ -13,17 +13,17 @@ #pragma once -#include <deque> -#include <vespa/vespalib/util/document_runnable.h> -#include <vespa/metrics/metrictimer.h> +#include "visitor.h" +#include "visitormetrics.h" +#include "visitormessagesessionfactory.h" +#include <vespa/storageframework/storageframework.h> +#include <vespa/storage/persistence/messages.h> +#include <vespa/storage/common/storagecomponent.h> #include <vespa/storageapi/messageapi/messagehandler.h> +#include <vespa/metrics/metrictimer.h> +#include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/storage/common/storagecomponent.h> -#include <vespa/storage/persistence/messages.h> -#include <vespa/storage/visiting/visitor.h> -#include <vespa/storage/visiting/visitormetrics.h> -#include <vespa/storage/visiting/visitormessagesessionfactory.h> -#include <vespa/storageframework/storageframework.h> +#include <deque> namespace storage { @@ -36,8 +36,7 @@ class VisitorThread : public framework::Runnable, typedef std::map<api::VisitorId, std::shared_ptr<Visitor> > VisitorMap; VisitorMap _visitors; - std::deque<std::pair<api::VisitorId, - framework::SecondTime> > _recentlyCompleted; + std::deque<std::pair<api::VisitorId, framework::SecondTime> > _recentlyCompleted; struct Event { enum Type { @@ -100,13 +99,9 @@ public: VisitorMessageHandler& sender); ~VisitorThread(); - void processMessage(api::VisitorId visitorId, - const std::shared_ptr<api::StorageMessage>& msg); - + void processMessage(api::VisitorId visitorId, const std::shared_ptr<api::StorageMessage>& msg); void shutdown(); - void setTimeBetweenTicks(uint32_t time) { _timeBetweenTicks = time; } - void handleMessageBusReply(std::unique_ptr<mbus::Reply> reply, Visitor& visitor); /** For unit tests needing to pause thread. */ @@ -117,7 +112,7 @@ public: } private: - virtual void run(framework::ThreadHandle&) override; + void run(framework::ThreadHandle&) override; /** * Attempt to fetch an event from the visitor thread's queue. If an event * was available, pop it from the queue and return it. If not, return @@ -127,12 +122,11 @@ private: Event popNextQueuedEventIfAvailable(); void tick(); void trimRecentlyCompletedList(framework::SecondTime currentTime); - void handleNonExistingVisitorCall(const Event& entry, - api::ReturnCode& code); + void handleNonExistingVisitorCall(const Event& entry, api::ReturnCode& code); std::shared_ptr<Visitor> createVisitor(const vespalib::stringref & libName, - const vdslib::Parameters& params, - vespalib::asciistream & error); + const vdslib::Parameters& params, + vespalib::asciistream & error); bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) override; @@ -142,12 +136,9 @@ private: /** Deletes a visitor instance. */ void close(); - void getStatus(vespalib::asciistream & out, - const framework::HttpUrlPath& path) const; - + void getStatus(vespalib::asciistream & out, const framework::HttpUrlPath& path) const; void updateMetrics(const MetricLockGuard &) override; }; } // storage - diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index bc71429032e..ed59b49ff04 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -1,11 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/base/testdocman.h> -#include <vespa/document/document.h> -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/document/update/fieldpathupdates.h> -#include <iomanip> -#include <sstream> #include <vespa/storageapi/message/persistence.h> #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/bucketsplitting.h> @@ -16,10 +10,16 @@ #include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/mbusprot/storagecommand.h> #include <vespa/storageapi/mbusprot/storagereply.h> +#include <vespa/storageapi/message/visitor.h> +#include <vespa/document/base/testdocman.h> +#include <vespa/document/document.h> +#include <vespa/document/repo/documenttyperepo.h> +#include <vespa/document/update/fieldpathupdates.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/util/growablebytebuffer.h> -#include <vespa/storageapi/message/visitor.h> #include <vespa/vespalib/objects/nbostream.h> +#include <iomanip> +#include <sstream> using std::shared_ptr; using document::ByteBuffer; @@ -837,8 +837,7 @@ namespace { api::StorageReply::UP makeReply() override; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "MyCommand()"; if (verbose) { out << " : "; @@ -850,8 +849,7 @@ namespace { struct MyReply : public api::InternalReply { MyReply(const MyCommand& cmd) : InternalReply(102, cmd) {} - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "MyReply()"; if (verbose) { out << " : "; diff --git a/storageapi/src/tests/testrunner.cpp b/storageapi/src/tests/testrunner.cpp index 9a07796a3f4..05fb3184c04 100644 --- a/storageapi/src/tests/testrunner.cpp +++ b/storageapi/src/tests/testrunner.cpp @@ -1,12 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("storageapicppunittestrunner"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h index 692cc171250..17ad75aa851 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h @@ -13,7 +13,6 @@ #pragma once -#include <stdint.h> #include <vespa/storageapi/defs.h> #include <vespa/vespalib/util/printable.h> #include <vespa/vespalib/util/xmlserializable.h> @@ -77,13 +76,10 @@ public: bool empty() const { return _metaCount == 0 && _usedFileSize == 0 && _checksum == 0; } - - void print(std::ostream& out, bool verbose, - const std::string& indent) const override - { + void print(std::ostream& out, bool verbose, const std::string& indent) const override { vespalib::AsciiPrintable::print(out, verbose, indent); } - virtual void print(vespalib::asciistream&, const PrintProperties&) const override; + void print(vespalib::asciistream&, const PrintProperties&) const override; void printXml(vespalib::XmlOutputStream&) const; }; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h index 9fa125b1159..f44de9700b7 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.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/storageapi/mbusprot/protocolserialization.h> +#include "protocolserialization.h" namespace storage { namespace mbusprot { @@ -11,29 +11,29 @@ public: ProtocolSerialization4_2(const document::DocumentTypeRepo::SP&); protected: - virtual void onEncode(GBBuf&, const api::GetCommand&) const override; - virtual void onEncode(GBBuf&, const api::RemoveCommand&) const override; - virtual void onEncode(GBBuf&, const api::RevertCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; - virtual void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; - virtual void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; - virtual void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; + void onEncode(GBBuf&, const api::GetCommand&) const override; + void onEncode(GBBuf&, const api::RemoveCommand&) const override; + void onEncode(GBBuf&, const api::RevertCommand&) const override; + void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; + void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; + void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; + void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; + void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; + void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; + void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; + void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; + void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; + void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; - virtual void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; + void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; + void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; virtual void onEncodeBucketInfoCommand(GBBuf&, const api::BucketInfoCommand&) const; virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const = 0; @@ -42,29 +42,29 @@ protected: virtual void onEncodeDiffEntry(GBBuf&, const api::GetBucketDiffCommand::Entry&) const; virtual void onEncode(GBBuf&, const api::ReturnCode&) const; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRevertCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; - virtual SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; - virtual SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; - virtual SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; - virtual SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; - virtual SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeGetCommand(BBuf&) const override; + SCmd::UP onDecodeRemoveCommand(BBuf&) const override; + SCmd::UP onDecodeRevertCommand(BBuf&) const override; + SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; + SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; + SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; + SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; + SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; + SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; + SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; - virtual SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; + SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; virtual void onDecodeBucketInfoCommand(BBuf&, api::BucketInfoCommand&) const; virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const = 0; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h index c5a26987a08..826700584da 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.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/storageapi/mbusprot/protocolserialization4_2.h> +#include "protocolserialization4_2.h" #include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { @@ -15,66 +15,64 @@ public: ProtocolSerialization5_0(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const override; + api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; - virtual void onEncode(GBBuf&, const api::PutCommand&) const override; - virtual void onEncode(GBBuf&, const api::PutReply&) const override; - virtual void onEncode(GBBuf&, const api::UpdateCommand&) const override; - virtual void onEncode(GBBuf&, const api::UpdateReply&) const override; - virtual void onEncode(GBBuf&, const api::GetReply&) const override; - virtual void onEncode(GBBuf&, const api::RemoveReply&) const override; - virtual void onEncode(GBBuf&, const api::RevertReply&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; - virtual void onEncode(GBBuf&, const api::MergeBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; - virtual void onEncode(GBBuf&, const api::SplitBucketReply&) const override; - virtual void onEncode(GBBuf&, const api::MultiOperationReply&) const override; - virtual void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; - virtual void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; + void onEncode(GBBuf&, const api::PutCommand&) const override; + void onEncode(GBBuf&, const api::PutReply&) const override; + void onEncode(GBBuf&, const api::UpdateCommand&) const override; + void onEncode(GBBuf&, const api::UpdateReply&) const override; + void onEncode(GBBuf&, const api::GetReply&) const override; + void onEncode(GBBuf&, const api::RemoveReply&) const override; + void onEncode(GBBuf&, const api::RevertReply&) const override; + void onEncode(GBBuf&, const api::CreateBucketReply&) const override; + void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; + void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; + void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + void onEncode(GBBuf&, const api::MergeBucketReply&) const override; + void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; + void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; + void onEncode(GBBuf&, const api::SplitBucketReply&) const override; + void onEncode(GBBuf&, const api::MultiOperationReply&) const override; + void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; + void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; + void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; - virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; + void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; virtual void onEncodeBucketReply(GBBuf&, const api::BucketReply&) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; - virtual void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; - virtual void onEncodeReply(GBBuf&, const api::StorageReply&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; + void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; + void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; + void onEncodeReply(GBBuf&, const api::StorageReply&) const override; - virtual SCmd::UP onDecodePutCommand(BBuf&) const override; - virtual SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeUpdateCommand(BBuf&) const override; - virtual SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; - virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; - virtual SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; - virtual SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; - virtual SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; + SCmd::UP onDecodePutCommand(BBuf&) const override; + SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeUpdateCommand(BBuf&) const override; + SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; + SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; + SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; + SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; - virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; + void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; virtual void onDecodeBucketReply(BBuf&, api::BucketReply&) const; - virtual SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; - virtual void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; - virtual void onDecodeReply(BBuf&, api::StorageReply&) const override; + SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; + void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; + void onDecodeReply(BBuf&, api::StorageReply&) const override; }; } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h index 393596046c2..92e559f5de9 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.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/storageapi/mbusprot/protocolserialization5_0.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> +#include "protocolserialization5_0.h" namespace storage { namespace mbusprot { @@ -17,24 +16,22 @@ public: ProtocolSerialization5_1(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; - virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const override; + api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; + void putBucketInfo(const api::BucketInfo& info, vespalib::GrowableByteBuffer& buf) const override; protected: - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; - virtual void onEncode(GBBuf&, const api::GetCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; - - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + void onEncode(GBBuf&, const api::GetCommand&) const override; + void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + + SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + SCmd::UP onDecodeGetCommand(BBuf&) const override; + SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; }; } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h index 35af05d192b..552d9ee3508 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_2.h @@ -3,9 +3,8 @@ #pragma once +#include "protocolserialization5_1.h" #include <vespa/vespalib/util/growablebytebuffer.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> #include <vespa/storageapi/message/persistence.h> namespace storage { @@ -14,20 +13,19 @@ namespace mbusprot { class ProtocolSerialization5_2 : public ProtocolSerialization5_1 { public: - ProtocolSerialization5_2( - const document::DocumentTypeRepo::SP& repo, - const documentapi::LoadTypeSet & loadTypes) + ProtocolSerialization5_2(const document::DocumentTypeRepo::SP& repo, + const documentapi::LoadTypeSet & loadTypes) : ProtocolSerialization5_1(repo, loadTypes) - {} + {} protected: - virtual void onEncode(GBBuf &, const api::PutCommand &) const override; - virtual void onEncode(GBBuf &, const api::RemoveCommand &) const override; - virtual void onEncode(GBBuf &, const api::UpdateCommand &) const override; + void onEncode(GBBuf &, const api::PutCommand &) const override; + void onEncode(GBBuf &, const api::RemoveCommand &) const override; + void onEncode(GBBuf &, const api::UpdateCommand &) const override; - virtual SCmd::UP onDecodePutCommand(BBuf &) const override; - virtual SCmd::UP onDecodeRemoveCommand(BBuf &) const override; - virtual SCmd::UP onDecodeUpdateCommand(BBuf &) const override; + SCmd::UP onDecodePutCommand(BBuf &) const override; + SCmd::UP onDecodeRemoveCommand(BBuf &) const override; + SCmd::UP onDecodeUpdateCommand(BBuf &) const override; static void decodeTasCondition(api::StorageCommand & cmd, BBuf & buf); static void encodeTasCondition(GBBuf & buf, const api::StorageCommand & cmd); diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h index 8549df6077f..d6d95e2b1fe 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "storagemessage.h" +#include "storageprotocol.h" #include <vespa/messagebus/message.h> -#include <vespa/storageapi/mbusprot/storagemessage.h> -#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagecommand.h> namespace storage { @@ -16,15 +16,13 @@ public: StorageCommand(const storage::api::StorageCommand::SP&); const mbus::string & getProtocol() const override { return StorageProtocol::NAME; } - uint32_t getType() const override { return _cmd->getType().getId(); } - const api::StorageCommand::SP& getCommand() { return _cmd; } api::StorageCommand::CSP getCommand() const { return _cmd; } - virtual api::StorageMessage::SP getInternalMessage() override { return _cmd; } - virtual api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } + api::StorageMessage::SP getInternalMessage() override { return _cmd; } + api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } - virtual uint8_t priority() const override { + uint8_t priority() const override { return ((getInternalMessage()->getPriority()) / 255) * 16; } @@ -34,4 +32,3 @@ private: } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h index 8c10ab1dfe1..e1bcff1b27c 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h @@ -1,12 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "protocolserialization5_2.h" #include <vespa/messagebus/iprotocol.h> -#include <string> -#include <vespa/storageapi/mbusprot/protocolserialization5_0.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_1.h> -#include <vespa/storageapi/mbusprot/protocolserialization5_2.h> -#include <vespa/documentapi/loadtypes/loadtypeset.h> namespace storage { namespace mbusprot { @@ -21,17 +17,10 @@ public: StorageProtocol(const document::DocumentTypeRepo::SP, const documentapi::LoadTypeSet& loadTypes); - // Implements IProtocol. const mbus::string& getName() const override { return NAME; } - - // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string& name, const mbus::string& param) const override; - - // Implements IProtocol. mbus::Blob encode(const vespalib::Version&, const mbus::Routable&) const override; - - // Implements IProtocol. mbus::Routable::UP decode(const vespalib::Version&, mbus::BlobRef) const override; private: @@ -42,6 +31,3 @@ private: } // mbusprot } // storage - - - diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h index aa7c827a32a..2e7dafc505f 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "storagemessage.h" +#include "storageprotocol.h" #include <vespa/messagebus/reply.h> -#include <vespa/storageapi/mbusprot/storagemessage.h> -#include <vespa/storageapi/mbusprot/storageprotocol.h> #include <vespa/storageapi/messageapi/storagereply.h> namespace storage { @@ -20,21 +20,19 @@ public: StorageReply(const mbus::BlobRef& data, const ProtocolSerialization&); StorageReply(const api::StorageReply::SP& reply); - virtual ~StorageReply(); + ~StorageReply(); - virtual const mbus::string& getProtocol() const override - { return StorageProtocol::NAME; } + const mbus::string& getProtocol() const override { return StorageProtocol::NAME; } uint32_t getType() const override { return _mbusType; } const api::StorageReply::SP& getReply() { deserialize(); return _reply; } api::StorageReply::CSP getReply() const { deserialize(); return _reply; } - virtual api::StorageMessage::SP getInternalMessage() override - { deserialize(); return _reply; } - virtual api::StorageMessage::CSP getInternalMessage() const override - { deserialize(); return _reply; } - virtual uint8_t priority() const override { + api::StorageMessage::SP getInternalMessage() override { deserialize(); return _reply; } + api::StorageMessage::CSP getInternalMessage() const override { deserialize(); return _reply; } + + uint8_t priority() const override { if (_reply.get()) { return _reply->getPriority(); } @@ -48,4 +46,3 @@ private: } // mbusprot } // storage - diff --git a/storageapi/src/vespa/storageapi/message/batch.h b/storageapi/src/vespa/storageapi/message/batch.h index 85e7a8df9ee..c2bb8b816b8 100644 --- a/storageapi/src/vespa/storageapi/message/batch.h +++ b/storageapi/src/vespa/storageapi/message/batch.h @@ -156,14 +156,13 @@ public: @return Returns a list of the updates to be performed. */ const UpdateList& getUpdates() const { return _updates; }; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Returns a bucket id suitable for routing this message. */ document::BucketId getBucketId() const override { return _bucketId; } - virtual bool hasSingleBucketId() const override { return true; } + bool hasSingleBucketId() const override { return true; } DECLARE_STORAGECOMMAND(BatchDocumentUpdateCommand, onBatchDocumentUpdate) @@ -183,18 +182,12 @@ class BatchDocumentUpdateReply : public StorageReply { std::vector<bool> _documentsNotFound; public: explicit BatchDocumentUpdateReply(const BatchDocumentUpdateCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - const std::vector<bool>& getDocumentsNotFound() const { return _documentsNotFound; } std::vector<bool>& getDocumentsNotFound() { return _documentsNotFound; } DECLARE_STORAGEREPLY(BatchDocumentUpdateReply, onBatchDocumentUpdateReply) }; - - } } - - diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index c78591eca61..31948852840 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -7,14 +7,14 @@ #pragma once -#include <vespa/document/base/globalid.h> -#include <vespa/vdslib/state/clusterstate.h> -#include <vespa/storageapi/defs.h> #include <vespa/storageapi/messageapi/bucketcommand.h> #include <vespa/storageapi/messageapi/bucketreply.h> #include <vespa/storageapi/messageapi/bucketinfocommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> #include <vespa/storageapi/messageapi/maintenancecommand.h> +#include <vespa/document/base/globalid.h> +#include <vespa/vdslib/state/clusterstate.h> +#include <vespa/storageapi/defs.h> namespace document { class DocumentTypeRepo; } @@ -32,12 +32,9 @@ class CreateBucketCommand : public MaintenanceCommand { public: explicit CreateBucketCommand(const document::BucketId& id); - void setActive(bool active) { _active = active; } bool getActive() const { return _active; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(CreateBucketCommand, onCreateBucket) }; @@ -50,9 +47,7 @@ public: class CreateBucketReply : public BucketInfoReply { public: explicit CreateBucketReply(const CreateBucketCommand& cmd); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(CreateBucketReply, onCreateBucketReply); }; @@ -69,9 +64,7 @@ public: const BucketInfo& getBucketInfo() const { return _info; } void setBucketInfo(const BucketInfo& info) { _info = info; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(DeleteBucketCommand, onDeleteBucket) }; @@ -84,9 +77,7 @@ public: class DeleteBucketReply : public BucketInfoReply { public: explicit DeleteBucketReply(const DeleteBucketCommand& cmd); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DeleteBucketReply, onDeleteBucketReply) }; @@ -136,14 +127,10 @@ public: const std::vector<Node>& getNodes() const { return _nodes; } Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } - uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - void setClusterStateVersion(uint32_t version) { _clusterStateVersion = version; } void setChain(const std::vector<uint16_t>& chain) { _chain = chain; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(MergeBucketCommand, onMergeBucket) }; @@ -173,8 +160,7 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<uint16_t>& getChain() const { return _chain; } uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(MergeBucketReply, onMergeBucketReply) }; @@ -198,8 +184,7 @@ public: uint16_t _hasMask; Entry(); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; bool operator<(const Entry& e) const { return (_timestamp < e._timestamp); } @@ -219,7 +204,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketDiffCommand, onGetBucketDiff) }; @@ -247,8 +232,7 @@ public: Timestamp getMaxTimestamp() const { return _maxTimestamp; } const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetBucketDiffReply, onGetBucketDiffReply) }; @@ -274,8 +258,7 @@ public: Entry(const GetBucketDiffCommand::Entry&); bool filled() const; - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; }; private: @@ -296,8 +279,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(ApplyBucketDiffCommand, onApplyBucketDiff) }; @@ -326,7 +308,7 @@ public: std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(ApplyBucketDiffReply, onApplyBucketDiffReply) }; @@ -359,13 +341,11 @@ public: RequestBucketInfoCommand(uint16_t distributor, const lib::ClusterState& state); - const std::vector<document::BucketId>& getBuckets() const - { return _buckets; } + const std::vector<document::BucketId>& getBuckets() const { return _buckets; } bool hasSystemState() const { return (_state.get() != 0); } uint16_t getDistributor() const { return _distributor; } - const lib::ClusterState& getSystemState() const - { return *_state; } + const lib::ClusterState& getSystemState() const { return *_state; } const vespalib::string& getDistributionHash() const { return _distributionHash; } @@ -402,14 +382,10 @@ public: explicit RequestBucketInfoReply(const RequestBucketInfoCommand& cmd); ~RequestBucketInfoReply(); - const EntryVector & getBucketInfo() const { return _buckets; } EntryVector & getBucketInfo() { return _buckets; } - uint32_t getMemoryFootprint() const override; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RequestBucketInfoReply, onRequestBucketInfoReply) }; @@ -426,15 +402,11 @@ public: */ class NotifyBucketChangeCommand : public BucketCommand { BucketInfo _info; - public: NotifyBucketChangeCommand(const document::BucketId& bucket, const BucketInfo& bucketInfo); - const BucketInfo& getBucketInfo() const { return _info; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(NotifyBucketChangeCommand, onNotifyBucketChange) }; @@ -451,9 +423,7 @@ public: class NotifyBucketChangeReply : public BucketReply { public: explicit NotifyBucketChangeReply(const NotifyBucketChangeCommand& cmd); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(NotifyBucketChangeReply, onNotifyBucketChangeReply) }; @@ -474,16 +444,13 @@ public: private: BUCKET_STATE _state; public: - SetBucketStateCommand(const document::BucketId& bucket, - BUCKET_STATE state); - + SetBucketStateCommand(const document::BucketId& bucket, BUCKET_STATE state); void print(std::ostream& out, bool verbose, const std::string& indent) const override; - BUCKET_STATE getState() const { return _state; } - DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState) private: - virtual vespalib::string getSummary() const override; + + vespalib::string getSummary() const override; }; /** @@ -496,12 +463,9 @@ class SetBucketStateReply : public BucketInfoReply { public: explicit SetBucketStateReply(const SetBucketStateCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(SetBucketStateReply, onSetBucketStateReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.h b/storageapi/src/vespa/storageapi/message/bucketsplitting.h index 6188a7cc44f..4e7c9397716 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.h +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.h @@ -57,7 +57,7 @@ public: void setMinByteSize(uint32_t v) { _minByteSize = v; } void setMinDocCount(uint32_t v) { _minDocCount = v; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SplitBucketCommand, onSplitBucket) }; @@ -71,19 +71,14 @@ public: class SplitBucketReply : public BucketReply { public: typedef std::pair<document::BucketId, BucketInfo> Entry; - -private: - std::vector<Entry> _result; - -public: explicit SplitBucketReply(const SplitBucketCommand& cmd); - std::vector<Entry>& getSplitInfo() { return _result; } const std::vector<Entry>& getSplitInfo() const { return _result; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SplitBucketReply, onSplitBucketReply) +private: + std::vector<Entry> _result; }; /** @@ -97,19 +92,13 @@ public: class JoinBucketsCommand : public MaintenanceCommand { std::vector<document::BucketId> _sources; uint8_t _minJoinBits; - public: explicit JoinBucketsCommand(const document::BucketId& target); - std::vector<document::BucketId>& getSourceBuckets() { return _sources; } - const std::vector<document::BucketId>& getSourceBuckets() const - { return _sources; } - + const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } void setMinJoinBits(uint8_t minJoinBits) { _minJoinBits = minJoinBits; } uint8_t getMinJoinBits() const { return _minJoinBits; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(JoinBucketsCommand, onJoinBuckets) }; @@ -121,20 +110,13 @@ public: */ class JoinBucketsReply : public BucketInfoReply { std::vector<document::BucketId> _sources; - public: explicit JoinBucketsReply(const JoinBucketsCommand& cmd); - JoinBucketsReply(const JoinBucketsCommand& cmd, const BucketInfo& bucketInfo); - - const std::vector<document::BucketId>& getSourceBuckets() const - { return _sources; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - + const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(JoinBucketsReply, onJoinBucketsReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h index 040f925f98a..642caa8e12a 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.h +++ b/storageapi/src/vespa/storageapi/message/datagram.h @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/document/bucket/bucketid.h> -#include <vespa/vdslib/container/documentlist.h> +#include "visitor.h" #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/storagereply.h> #include <vespa/storageapi/defs.h> -#include <vespa/storageapi/message/visitor.h> +#include <vespa/vdslib/container/documentlist.h> namespace storage { namespace api { @@ -33,16 +32,11 @@ public: { assert(_docBlock.getBufferSize() > 0); return _docBlock; } const vdslib::DocumentList& getDocumentBlock() const { assert(_docBlock.getBufferSize() > 0); return _docBlock; } - - void setDocumentBlock(vdslib::DocumentList& block) { - _docBlock = block; - } + void setDocumentBlock(vdslib::DocumentList& block) { _docBlock = block; } document::BucketId getBucketId() const override { return _bucketId; } - virtual bool hasSingleBucketId() const override { return true; } - + bool hasSingleBucketId() const override { return true; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool keepTimeStamps() const { return _keepTimeStamps; } void keepTimeStamps(bool keepTime) { _keepTimeStamps = keepTime; } @@ -58,9 +52,7 @@ public: class DocBlockReply : public StorageReply { public: explicit DocBlockReply(const DocBlockCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocBlockReply, onDocBlockReply) }; @@ -76,15 +68,11 @@ public: */ class MapVisitorCommand : public StorageCommand { vdslib::Parameters _statistics; - public: MapVisitorCommand(); - vdslib::Parameters& getData() { return _statistics; }; const vdslib::Parameters& getData() const { return _statistics; }; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(MapVisitorCommand, onMapVisitor) }; @@ -97,9 +85,7 @@ public: class MapVisitorReply : public StorageReply { public: explicit MapVisitorReply(const MapVisitorCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(MapVisitorReply, onMapVisitorReply) }; @@ -120,7 +106,6 @@ public: bool _removeEntry; Entry() : _doc(), _lastModified(0), _removeEntry(false) {} - Entry(const document::Document::SP& doc, int64_t lastModified, bool removeEntry) : _doc(doc), @@ -132,18 +117,13 @@ public: private: document::BucketId _bucketId; std::vector<Entry> _documents; - public: DocumentListCommand(const document::BucketId& bid); - const document::BucketId& getBucketId() { return _bucketId; } std::vector<Entry>& getDocuments() { return _documents; } const std::vector<Entry>& getDocuments() const { return _documents; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(DocumentListCommand, onDocumentList) - }; std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e); @@ -157,9 +137,7 @@ std::ostream& operator<<(std::ostream& out, const DocumentListCommand::Entry& e) class DocumentListReply : public StorageReply { public: explicit DocumentListReply(const DocumentListCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocumentListReply, onDocumentListReply) }; @@ -176,18 +154,11 @@ public: */ class EmptyBucketsCommand : public StorageCommand { std::vector<document::BucketId> _buckets; - public: EmptyBucketsCommand(const std::vector<document::BucketId>&); - - const std::vector<document::BucketId>& getBuckets() const - { return _buckets; } - + const std::vector<document::BucketId>& getBuckets() const { return _buckets; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(EmptyBucketsCommand, onEmptyBuckets) - -private: }; /** @@ -199,12 +170,9 @@ private: class EmptyBucketsReply : public StorageReply { public: explicit EmptyBucketsReply(const EmptyBucketsCommand&); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(EmptyBucketsReply, onEmptyBucketsReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/documentsummary.h b/storageapi/src/vespa/storageapi/message/documentsummary.h index b32723c6ddb..d9f943afc07 100644 --- a/storageapi/src/vespa/storageapi/message/documentsummary.h +++ b/storageapi/src/vespa/storageapi/message/documentsummary.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -18,13 +18,10 @@ class DocumentSummaryCommand : public StorageCommand, { public: explicit DocumentSummaryCommand(); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const override { return getSerializedSize(); } - DECLARE_STORAGECOMMAND(DocumentSummaryCommand, onDocumentSummary) }; @@ -37,12 +34,9 @@ public: class DocumentSummaryReply : public StorageReply { public: explicit DocumentSummaryReply(const DocumentSummaryCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(DocumentSummaryReply, onDocumentSummaryReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index 470acca566b..251750eed60 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -67,12 +67,9 @@ public: uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 20; } - vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(PutCommand, onPut); }; @@ -140,8 +137,7 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(UpdateCommand, onUpdate); }; @@ -203,9 +199,7 @@ public: GetCommand(const document::BucketId&, const document::DocumentId&, const vespalib::stringref & fieldSet, Timestamp before = MAX_TIMESTAMP); ~GetCommand(); - void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } - const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } const vespalib::string& getFieldSet() const { return _fieldSet; } @@ -214,7 +208,7 @@ public: vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(GetCommand, onGet) }; @@ -246,13 +240,10 @@ public: Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } bool wasFound() const { return (_doc.get() != 0); } - uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 30; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(GetReply, onGetReply) }; @@ -267,20 +258,15 @@ class RemoveCommand : public TestAndSetCommand { Timestamp _timestamp; public: - RemoveCommand(const document::BucketId&, const document::DocumentId& docId, - Timestamp timestamp); + RemoveCommand(const document::BucketId&, const document::DocumentId& docId, Timestamp timestamp); ~RemoveCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } - const document::DocumentId& getDocumentId() const override { return _docId; } Timestamp getTimestamp() const { return _timestamp; } - vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; - + StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(RemoveCommand, onRemove) }; @@ -294,7 +280,6 @@ class RemoveReply : public BucketInfoReply { document::DocumentId _docId; Timestamp _timestamp; Timestamp _oldTimestamp; - public: explicit RemoveReply(const RemoveCommand& cmd, Timestamp oldTimestamp = 0); ~RemoveReply(); @@ -302,13 +287,9 @@ public: const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getTimestamp() { return _timestamp; }; Timestamp getOldTimestamp() const { return _oldTimestamp; } - void setOldTimestamp(Timestamp oldTimestamp) { _oldTimestamp = oldTimestamp; } - bool wasFound() const { return (_oldTimestamp != 0); } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RemoveReply, onRemoveReply) }; @@ -320,16 +301,12 @@ public: */ class RevertCommand : public BucketInfoCommand { std::vector<Timestamp> _tokens; - public: RevertCommand(const document::BucketId& bucket, const std::vector<Timestamp>& revertTokens); ~RevertCommand(); - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(RevertCommand, onRevert) }; @@ -341,19 +318,13 @@ public: */ class RevertReply : public BucketInfoReply { std::vector<Timestamp> _tokens; - public: explicit RevertReply(const RevertCommand& cmd); ~RevertReply(); - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RevertReply, onRevertReply) }; } // api } // storage - - diff --git a/storageapi/src/vespa/storageapi/message/queryresult.h b/storageapi/src/vespa/storageapi/message/queryresult.h index 8020fa22dea..282a45ee43b 100644 --- a/storageapi/src/vespa/storageapi/message/queryresult.h +++ b/storageapi/src/vespa/storageapi/message/queryresult.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" #include <vespa/vdslib/container/searchresult.h> #include <vespa/vdslib/container/documentsummary.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -43,12 +43,9 @@ private: class QueryResultReply : public StorageReply { public: explicit QueryResultReply(const QueryResultCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(QueryResultReply, onQueryResultReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 08b5663e2d6..6232ddece90 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -5,7 +5,6 @@ #include <vespa/storageapi/messageapi/storagecommand.h> #include <vespa/storageapi/messageapi/bucketinforeply.h> - namespace storage { namespace api { @@ -15,17 +14,12 @@ public: RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::BucketId&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const override; - + void print(std::ostream& out, bool verbose, const std::string& indent) const override; uint32_t getMemoryFootprint() const override { return _documentSelection.length(); } - const vespalib::string& getDocumentSelection() const { return _documentSelection; } - DECLARE_STORAGECOMMAND(RemoveLocationCommand, onRemoveLocation); - private: vespalib::string _documentSelection; }; @@ -34,10 +28,8 @@ class RemoveLocationReply : public BucketInfoReply { public: RemoveLocationReply(const RemoveLocationCommand& cmd); - DECLARE_STORAGEREPLY(RemoveLocationReply, onRemoveLocationReply) }; } } - diff --git a/storageapi/src/vespa/storageapi/message/searchresult.h b/storageapi/src/vespa/storageapi/message/searchresult.h index b2662800a9d..220f48a5973 100644 --- a/storageapi/src/vespa/storageapi/message/searchresult.h +++ b/storageapi/src/vespa/storageapi/message/searchresult.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "visitor.h" #include <vespa/vdslib/container/searchresult.h> -#include <vespa/storageapi/message/visitor.h> namespace storage { namespace api { @@ -16,13 +16,8 @@ namespace api { class SearchResultCommand : public StorageCommand, public vdslib::SearchResult { public: SearchResultCommand(); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - uint32_t getMemoryFootprint() const override { - return getSerializedSize(); - } - + uint32_t getMemoryFootprint() const override { return getSerializedSize(); } DECLARE_STORAGECOMMAND(SearchResultCommand, onSearchResult) }; @@ -35,12 +30,9 @@ public: class SearchResultReply : public StorageReply { public: explicit SearchResultReply(const SearchResultCommand& command); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(SearchResultReply, onSearchResultReply) }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/stat.h b/storageapi/src/vespa/storageapi/message/stat.h index 3ee4afbb4ba..071f3e8ebdd 100644 --- a/storageapi/src/vespa/storageapi/message/stat.h +++ b/storageapi/src/vespa/storageapi/message/stat.h @@ -20,30 +20,22 @@ namespace api { class StatBucketCommand : public BucketCommand { private: vespalib::string _docSelection; - public: StatBucketCommand(const document::BucketId& bucket, const vespalib::stringref & documentSelection); const vespalib::string& getDocumentSelection() const { return _docSelection; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; - + StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(StatBucketCommand, onStatBucket); }; class StatBucketReply : public BucketReply { vespalib::string _results; - public: StatBucketReply(const StatBucketCommand&, const vespalib::stringref & results = ""); - const vespalib::string& getResults() { return _results; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(StatBucketReply, onStatBucketReply) }; @@ -60,9 +52,7 @@ public: class GetBucketListCommand : public BucketCommand { public: GetBucketListCommand(const document::BucketId& bucket); - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(GetBucketListCommand, onGetBucketList); }; @@ -76,8 +66,7 @@ public: const vespalib::stringref & bucketInformation) : _bucket(id), _bucketInformation(bucketInformation) - { - } + {} bool operator==(const BucketInfo& other) const { return (_bucket == other._bucket @@ -90,12 +79,9 @@ private: public: GetBucketListReply(const GetBucketListCommand&); - std::vector<BucketInfo>& getBuckets() { return _buckets; } const std::vector<BucketInfo>& getBuckets() const { return _buckets; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(GetBucketListReply, onGetBucketListReply) }; @@ -104,4 +90,3 @@ std::ostream& operator<<(std::ostream& out, const GetBucketListReply::BucketInfo } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/state.h b/storageapi/src/vespa/storageapi/message/state.h index 12a357c1b40..86830f86e7b 100644 --- a/storageapi/src/vespa/storageapi/message/state.h +++ b/storageapi/src/vespa/storageapi/message/state.h @@ -1,9 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * @file state.h - * - * State commands. - */ + #pragma once #include <vespa/storageapi/messageapi/storagecommand.h> @@ -25,9 +21,7 @@ class GetNodeStateCommand : public StorageCommand { public: explicit GetNodeStateCommand(lib::NodeState::UP expectedState); - const lib::NodeState* getExpectedState() const - { return _expectedState.get(); } - + const lib::NodeState* getExpectedState() const { return _expectedState.get(); } void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetNodeStateCommand, onGetNodeState) @@ -71,9 +65,7 @@ class SetSystemStateCommand : public StorageCommand { public: explicit SetSystemStateCommand(const lib::ClusterState&); - const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SetSystemStateCommand, onSetSystemState) @@ -93,7 +85,6 @@ public: // Not serialized. Available locally const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SetSystemStateReply, onSetSystemStateReply) @@ -101,4 +92,3 @@ public: } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index a9d1de402da..c1d0bb637a0 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -108,14 +108,11 @@ public: void setVisitorOrdering(document::OrderingSpecification::Order ordering) { _ordering = ordering; } document::OrderingSpecification::Order getVisitorOrdering() const { return _ordering; } - void setMaxBucketsPerVisitor(uint32_t max) - { _maxBucketsPerVisitor = max; } - uint32_t getMaxBucketsPerVisitor() const - { return _maxBucketsPerVisitor; } + void setMaxBucketsPerVisitor(uint32_t max) { _maxBucketsPerVisitor = max; } + uint32_t getMaxBucketsPerVisitor() const { return _maxBucketsPerVisitor; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; + StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(CreateVisitorCommand, onCreateVisitor) }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h index 7c078b9545a..95b2284661a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h @@ -8,8 +8,7 @@ #pragma once -#include <vespa/document/bucket/bucketid.h> -#include <vespa/storageapi/messageapi/storagecommand.h> +#include "storagecommand.h" namespace storage { namespace api { @@ -32,13 +31,9 @@ public: document::BucketId getBucketId() const override { return _bucket; } bool hasBeenRemapped() const { return (_originalBucket.getRawId() != 0); } - const document::BucketId& getOriginalBucketId() const - { return _originalBucket; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - - virtual bool hasSingleBucketId() const override { return true; } - + const document::BucketId& getOriginalBucketId() const { return _originalBucket; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; + bool hasSingleBucketId() const override { return true; } }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h index 62171a9e3c0..d9d924bc338 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h @@ -12,7 +12,7 @@ #pragma once -#include <vespa/storageapi/messageapi/bucketcommand.h> +#include "bucketcommand.h" namespace storage { namespace api { @@ -24,8 +24,7 @@ protected: public: DECLARE_POINTER_TYPEDEFS(BucketInfoCommand); - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h index d39a6a5eaf8..d5b174e4f2e 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h @@ -12,9 +12,9 @@ #pragma once +#include "bucketreply.h" +#include "bucketinfocommand.h" #include <vespa/storageapi/buckets/bucketinfo.h> -#include <vespa/storageapi/messageapi/bucketreply.h> -#include <vespa/storageapi/messageapi/bucketinfocommand.h> namespace storage { namespace api { @@ -31,11 +31,8 @@ public: const BucketInfo& getBucketInfo() const { return _result; }; void setBucketInfo(const BucketInfo& info) { _result = info; } - - /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h index 833f1396c49..0cd2c2065fe 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h @@ -8,8 +8,7 @@ #pragma once -#include <vespa/document/bucket/bucketid.h> -#include <vespa/storageapi/messageapi/storagereply.h> +#include "storagereply.h" namespace storage { namespace api { @@ -39,10 +38,8 @@ public: if (_originalBucket.getRawId() == 0) _originalBucket = _bucket; _bucket = bucket; } - - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h index 66873dfba27..131ee8d2400 100644 --- a/storageapi/src/vespa/storageapi/messageapi/messagehandler.h +++ b/storageapi/src/vespa/storageapi/messageapi/messagehandler.h @@ -13,6 +13,7 @@ #pragma once +#include <memory> namespace storage { namespace api { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp index f11d91b7079..e2d10487431 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.cpp @@ -1,10 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "returncode.h" -#include <vespa/messagebus/errorcode.h> - -#include <vespa/document/util/bytebuffer.h> -#include <vespa/fnet/frt/error.h> #include <ostream> namespace storage { diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.h b/storageapi/src/vespa/storageapi/messageapi/returncode.h index a7be570e8f4..0aa87c64012 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.h +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.h @@ -14,7 +14,6 @@ #include <vespa/document/util/serializable.h> #include <vespa/documentapi/messagebus/documentprotocol.h> #include <iosfwd> -#include <string> namespace document { class ByteBuffer; @@ -68,9 +67,7 @@ public: private: Result _result; vespalib::string _message; - - void onDeserialize(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer) override; + void onDeserialize(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer) override; void onSerialize(document::ByteBuffer& buffer) const override; public: @@ -123,4 +120,3 @@ public: } // api } // storage - diff --git a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h index 00f17458e6a..d67cbcf2bcb 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h @@ -12,7 +12,7 @@ #pragma once -#include <vespa/storageapi/messageapi/storagemessage.h> +#include "storagemessage.h" namespace storage { namespace api { @@ -46,7 +46,7 @@ public: void setNewId() { StorageMessage::setNewMsgId(); } /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * A way for someone to make a reply to a storage message without diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index 47dd93a9535..8801916c14b 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -11,11 +11,11 @@ #pragma once +#include "messagehandler.h" #include <map> #include <vespa/vespalib/util/printable.h> #include <vespa/messagebus/routing/route.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/storageapi/messageapi/messagehandler.h> #include <vespa/vdslib/state/nodetype.h> #include <vespa/messagebus/trace.h> #include <vespa/documentapi/loadtypes/loadtype.h> @@ -42,9 +42,8 @@ namespace vespalib { public: \ DECLARE_POINTER_TYPEDEFS(reply) \ private: \ - virtual bool callHandler( \ - MessageHandler& h, \ - const std::shared_ptr<StorageMessage>& m) const override \ + bool callHandler(MessageHandler& h, \ + const std::shared_ptr<StorageMessage>& m) const override \ { \ return h.callback(std::static_pointer_cast<reply>(m)); \ } @@ -66,7 +65,7 @@ public: \ #define IMPLEMENT_COMMAND(command, reply) \ IMPLEMENT_COMMON(command) \ std::unique_ptr<storage::api::StorageReply> \ - storage::api::command::makeReply() \ + storage::api::command::makeReply() \ { \ return std::unique_ptr<storage::api::StorageReply>(new reply(*this)); \ } diff --git a/storageapi/src/vespa/storageapi/messageapi/storagereply.h b/storageapi/src/vespa/storageapi/messageapi/storagereply.h index eab6470f463..4d185ea7a29 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagereply.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagereply.h @@ -12,8 +12,8 @@ #pragma once -#include <vespa/storageapi/messageapi/returncode.h> -#include <vespa/storageapi/messageapi/storagemessage.h> +#include "returncode.h" +#include "storagemessage.h" namespace storage { namespace api { @@ -34,9 +34,7 @@ public: void setResult(const ReturnCode& r) { _result = r; } void setResult(ReturnCode::Result r) { _result = ReturnCode(r); } const ReturnCode& getResult() const { return _result; } - - /** Overload this to get more descriptive output. */ - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageframework/src/tests/clock/timetest.cpp b/storageframework/src/tests/clock/timetest.cpp index ae07559e095..d0367449fe1 100644 --- a/storageframework/src/tests/clock/timetest.cpp +++ b/storageframework/src/tests/clock/timetest.cpp @@ -10,9 +10,6 @@ namespace defaultimplementation { struct TimeTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testBasics(); void testCreatedFromClock(); void canAssignMicrosecondResolutionTimeToFakeClock(); diff --git a/storageframework/src/tests/memory/memorymanagertest.cpp b/storageframework/src/tests/memory/memorymanagertest.cpp index 885ae86e832..8b1868a6bd4 100644 --- a/storageframework/src/tests/memory/memorymanagertest.cpp +++ b/storageframework/src/tests/memory/memorymanagertest.cpp @@ -155,8 +155,7 @@ MemoryManagerTest::testBasics() struct ReduceI : public framework::ReduceMemoryUsageInterface { framework::MemoryToken::UP _token; - virtual uint64_t reduceMemoryConsumption(const MemoryToken& token, uint64_t reduceBy) override - { + uint64_t reduceMemoryConsumption(const MemoryToken& token, uint64_t reduceBy) override { assert(&token == _token.get()); (void) &token; assert(_token->getSize() >= reduceBy); diff --git a/storageframework/src/tests/memory/memorystatetest.cpp b/storageframework/src/tests/memory/memorystatetest.cpp index 40d102199d6..5a047a5c790 100644 --- a/storageframework/src/tests/memory/memorystatetest.cpp +++ b/storageframework/src/tests/memory/memorystatetest.cpp @@ -2,7 +2,6 @@ #include <vespa/storageframework/defaultimplementation/clock/realclock.h> #include <vespa/storageframework/defaultimplementation/memory/memorystate.h> -#include <vespa/storageframework/generic/memory/memorymanagerinterface.h> #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/vespalib/util/exceptions.h> @@ -12,8 +11,6 @@ namespace defaultimplementation { struct MemoryStateTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} void testBasics(); @@ -30,15 +27,15 @@ private: std::map<std::string, framework::MemoryAllocationType> _types; public: - virtual void setMaximumMemoryUsage(uint64_t max) override { (void) max; } + void setMaximumMemoryUsage(uint64_t max) override { (void) max; } - virtual const framework::MemoryAllocationType& + const framework::MemoryAllocationType& registerAllocationType(const framework::MemoryAllocationType& type) override { _types[type.getName()] = type; return _types[type.getName()]; } - virtual const framework::MemoryAllocationType& + const framework::MemoryAllocationType& getAllocationType(const std::string& name) const override { std::map<std::string, framework::MemoryAllocationType>::const_iterator iter = _types.find(name); @@ -50,8 +47,7 @@ public: return iter->second; } - virtual std::vector<const MemoryAllocationType*> getAllocationTypes() const override - { + std::vector<const MemoryAllocationType*> getAllocationTypes() const override { std::vector<const MemoryAllocationType*> types; for(std::map<std::string, framework::MemoryAllocationType> ::const_iterator it = _types.begin(); it != _types.end(); ++it) diff --git a/storageframework/src/tests/testrunner.cpp b/storageframework/src/tests/testrunner.cpp index 0d40a0429d9..5baa0f60b6e 100644 --- a/storageframework/src/tests/testrunner.cpp +++ b/storageframework/src/tests/testrunner.cpp @@ -6,7 +6,7 @@ LOG_SETUP("persistencecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/storageframework/src/tests/thread/taskthreadtest.cpp b/storageframework/src/tests/thread/taskthreadtest.cpp index bca5c81ef01..a6698be3676 100644 --- a/storageframework/src/tests/thread/taskthreadtest.cpp +++ b/storageframework/src/tests/thread/taskthreadtest.cpp @@ -34,7 +34,7 @@ namespace { struct MyThread : public TaskThread<Task> { MyThread(ThreadLock& lock) : TaskThread<Task>(lock) {} - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { + ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } }; diff --git a/storageframework/src/tests/thread/tickingthreadtest.cpp b/storageframework/src/tests/thread/tickingthreadtest.cpp index c65b809e5da..c9d54fe557a 100644 --- a/storageframework/src/tests/thread/tickingthreadtest.cpp +++ b/storageframework/src/tests/thread/tickingthreadtest.cpp @@ -13,9 +13,6 @@ namespace defaultimplementation { struct TickingThreadTest : public CppUnit::TestFixture { - void setUp() override {} - void tearDown() override {} - void testTicksBeforeWaitBasic(); void testTicksBeforeWaitLiveUpdate(); void testDestroyWithoutStarting(); @@ -62,7 +59,7 @@ struct MyApp : public TickingThread { void start(ThreadPool& p) { _threadPool->start(p); } - virtual ThreadWaitInfo doCriticalTick(ThreadIndex index) override { + ThreadWaitInfo doCriticalTick(ThreadIndex index) override { assert(index < _context.size()); Context& c(_context[index]); if (_doCritOverlapTest) { @@ -74,13 +71,12 @@ struct MyApp : public TickingThread { ++c._critTickCount; return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex index) override { + ThreadWaitInfo doNonCriticalTick(ThreadIndex index) override { assert(index < _context.size()); Context& c(_context[index]); ++c._nonCritTickCount; return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } - uint64_t getMinCritTick() { uint64_t min = std::numeric_limits<uint64_t>().max(); for (uint32_t i=0; i<_context.size(); ++i) { @@ -314,7 +310,7 @@ struct BroadcastApp : public TickingThread { void start(ThreadPool& p) { _threadPool->start(p); } - virtual ThreadWaitInfo doCriticalTick(ThreadIndex) override { + ThreadWaitInfo doCriticalTick(ThreadIndex) override { if (!_queue.empty()) { for (uint32_t i=0; i<_queue.size(); ++i) { printTaskInfo(_queue[i], "activating"); @@ -325,7 +321,7 @@ struct BroadcastApp : public TickingThread { } return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { + ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { if (!_active.empty()) { for (uint32_t i=0; i<_active.size(); ++i) { printTaskInfo(_queue[i], "processing"); diff --git a/storageserver/src/tests/testrunner.cpp b/storageserver/src/tests/testrunner.cpp index 5d8dc8d4c1f..70c4b4cdb5c 100644 --- a/storageserver/src/tests/testrunner.cpp +++ b/storageserver/src/tests/testrunner.cpp @@ -1,14 +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 <iostream> -#include <vespa/log/log.h> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> - +#include <vespa/log/log.h> LOG_SETUP("storagecppunittests"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/vbench/src/apps/dumpurl/dumpurl.cpp b/vbench/src/apps/dumpurl/dumpurl.cpp index 706dd061763..44ebc1d2ac2 100644 --- a/vbench/src/apps/dumpurl/dumpurl.cpp +++ b/vbench/src/apps/dumpurl/dumpurl.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 <vbench/http/http_result_handler.h> #include <vbench/http/server_spec.h> #include <vbench/http/http_client.h> +#include <vespa/fastos/app.h> using namespace vbench; @@ -13,14 +14,14 @@ public: }; struct MyHttpHandler : public HttpResultHandler { - virtual void handleHeader(const string &name, const string &value) override { + void handleHeader(const string &name, const string &value) override { fprintf(stderr, "got header: '%s': '%s'\n", name.c_str(), value.c_str()); } - virtual void handleContent(const Memory &data) override { + void handleContent(const Memory &data) override { fprintf(stderr, "got data: %zu bytes\n", data.size); fwrite(data.data, 1, data.size, stdout); } - virtual void handleFailure(const string &reason) override { + void handleFailure(const string &reason) override { fprintf(stderr, "got FAILURE: '%s'\n", reason.c_str()); } }; diff --git a/vbench/src/apps/vbench/vbench.cpp b/vbench/src/apps/vbench/vbench.cpp index 32af3d70c3d..fa6bc91e035 100644 --- a/vbench/src/apps/vbench/vbench.cpp +++ b/vbench/src/apps/vbench/vbench.cpp @@ -1,13 +1,10 @@ // 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/vespalib/util/signalhandler.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/util/thread.h> #include <vespa/vespalib/util/runnable_pair.h> #include <vbench/vbench/vbench.h> -#include <vespa/vespalib/data/slime/slime.h> -#include <string> #include <iostream> using namespace vbench; @@ -17,7 +14,7 @@ typedef vespalib::SignalHandler SIG; struct NotifyDone : public vespalib::Runnable { vespalib::Gate &done; NotifyDone(vespalib::Gate &d) : done(d) {} - virtual void run() override { + void run() override { done.countDown(); } }; diff --git a/vbench/src/tests/dispatcher/dispatcher_test.cpp b/vbench/src/tests/dispatcher/dispatcher_test.cpp index 284f7c55d8a..0a278508d55 100644 --- a/vbench/src/tests/dispatcher/dispatcher_test.cpp +++ b/vbench/src/tests/dispatcher/dispatcher_test.cpp @@ -7,14 +7,14 @@ using namespace vbench; struct MyHandler : public Handler<int> { int value; MyHandler() : value(-1) {} - virtual void handle(std::unique_ptr<int> v) override { value = (v.get() != 0) ? *v : 0; } + void handle(std::unique_ptr<int> v) override { value = (v.get() != 0) ? *v : 0; } }; struct Fetcher : public vespalib::Runnable { Provider<int> &provider; Handler<int> &handler; Fetcher(Provider<int> &p, Handler<int> &h) : provider(p), handler(h) {} - virtual void run() override { handler.handle(provider.provide()); } + void run() override { handler.handle(provider.provide()); } }; TEST("dispatcher") { diff --git a/vbench/src/tests/handler_thread/handler_thread_test.cpp b/vbench/src/tests/handler_thread/handler_thread_test.cpp index a21bda82b6a..e8816e1cc96 100644 --- a/vbench/src/tests/handler_thread/handler_thread_test.cpp +++ b/vbench/src/tests/handler_thread/handler_thread_test.cpp @@ -6,7 +6,7 @@ using namespace vbench; struct MyHandler : Handler<int> { std::vector<int> values; - virtual void handle(std::unique_ptr<int> value) override { + void handle(std::unique_ptr<int> value) override { values.push_back(*value); vespalib::Thread::sleep(10); // for improved coverage } diff --git a/vbench/src/tests/socket/socket_test.cpp b/vbench/src/tests/socket/socket_test.cpp index 21c410f382e..56499a089b6 100644 --- a/vbench/src/tests/socket/socket_test.cpp +++ b/vbench/src/tests/socket/socket_test.cpp @@ -34,7 +34,7 @@ struct Agent { struct Client : public Agent, public vespalib::Runnable { Client(Stream::UP s) : Agent(std::move(s)) {} - virtual void run() override { + void run() override { TEST_THREAD("client"); write("client-"); read("server-"); @@ -43,7 +43,7 @@ struct Client : public Agent, public vespalib::Runnable { struct Server : public Agent, public vespalib::Runnable { Server(Stream::UP s) : Agent(std::move(s)) {} - virtual void run() override { + void run() override { TEST_THREAD("server"); read("client-"); write("server-"); diff --git a/vbench/src/vbench/core/handler.h b/vbench/src/vbench/core/handler.h index 962e6c09ad7..3959688d949 100644 --- a/vbench/src/vbench/core/handler.h +++ b/vbench/src/vbench/core/handler.h @@ -17,4 +17,3 @@ struct Handler }; } // namespace vbench - diff --git a/vbench/src/vbench/core/input_file_reader.h b/vbench/src/vbench/core/input_file_reader.h index 410f0819d3b..5883faab9aa 100644 --- a/vbench/src/vbench/core/input_file_reader.h +++ b/vbench/src/vbench/core/input_file_reader.h @@ -4,9 +4,9 @@ #include "string.h" #include "taintable.h" +#include "line_reader.h" #include <vespa/vespalib/io/mapped_file_input.h> #include <vespa/vespalib/data/input_reader.h> -#include "line_reader.h" namespace vbench { @@ -34,7 +34,7 @@ public: **/ bool readLine(string &dst); - virtual const Taint &tainted() const override { return _taint; } + const Taint &tainted() const override { return _taint; } }; } // namespace vbench diff --git a/vbench/src/vbench/core/socket.cpp b/vbench/src/vbench/core/socket.cpp index 7306d25cf32..e11acdb864c 100644 --- a/vbench/src/vbench/core/socket.cpp +++ b/vbench/src/vbench/core/socket.cpp @@ -40,6 +40,8 @@ Socket::Socket(const string &host, int port) } } +Socket::~Socket() { } + Memory Socket::obtain() { diff --git a/vbench/src/vbench/core/socket.h b/vbench/src/vbench/core/socket.h index e961994c37a..a447dd4d592 100644 --- a/vbench/src/vbench/core/socket.h +++ b/vbench/src/vbench/core/socket.h @@ -29,12 +29,13 @@ private: public: Socket(vespalib::SocketHandle socket); Socket(const string &host, int port); - virtual bool eof() const override { return _eof; } - virtual Memory obtain() override; - virtual Input &evict(size_t bytes) override; - virtual WritableMemory reserve(size_t bytes) override; - virtual Output &commit(size_t bytes) override; - virtual const Taint &tainted() const override { return _taint; } + ~Socket(); + bool eof() const override { return _eof; } + Memory obtain() override; + Input &evict(size_t bytes) override; + WritableMemory reserve(size_t bytes) override; + Output &commit(size_t bytes) override; + const Taint &tainted() const override { return _taint; } }; struct ServerSocket { @@ -53,4 +54,3 @@ struct ServerSocket { }; } // namespace vbench - diff --git a/vbench/src/vbench/core/string.h b/vbench/src/vbench/core/string.h index 61a2b3b442c..592e63e9cbf 100644 --- a/vbench/src/vbench/core/string.h +++ b/vbench/src/vbench/core/string.h @@ -10,6 +10,8 @@ #include <string> #endif +#include <vector> + namespace vbench { // define which string class to use diff --git a/vbench/src/vbench/core/taintable.cpp b/vbench/src/vbench/core/taintable.cpp index 23e2745999a..34d65513ca7 100644 --- a/vbench/src/vbench/core/taintable.cpp +++ b/vbench/src/vbench/core/taintable.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 "taintable.h" namespace vbench { @@ -9,8 +8,9 @@ namespace { struct Untaintable : Taintable { Taint taint; - virtual const Taint &tainted() const override { return taint; } - virtual ~Untaintable() {} + + const Taint &tainted() const override { return taint; } + ~Untaintable() {} }; Untaintable untaintable; diff --git a/vbench/src/vbench/http/benchmark_headers.cpp b/vbench/src/vbench/http/benchmark_headers.cpp index e4bea82023d..c42af2a79c7 100644 --- a/vbench/src/vbench/http/benchmark_headers.cpp +++ b/vbench/src/vbench/http/benchmark_headers.cpp @@ -1,7 +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 "benchmark_headers.h" #include <map> @@ -77,7 +75,7 @@ BenchmarkHeaders::toString() const struct HeaderToString : benchmark_headers::HeaderTraverser { string &str; HeaderToString(string &s) : str(s) {} - virtual void header(const string &name, double value) override { + void header(const string &name, double value) override { str += strfmt(" %s: %g\n", name.c_str(), value); } } headerToString(str); diff --git a/vbench/src/vbench/http/http_result_handler.h b/vbench/src/vbench/http/http_result_handler.h index 85c230fefb8..18e8955b65e 100644 --- a/vbench/src/vbench/http/http_result_handler.h +++ b/vbench/src/vbench/http/http_result_handler.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once #include <vbench/core/string.h> @@ -23,4 +22,3 @@ struct HttpResultHandler }; } // namespace vbench - diff --git a/vbench/src/vbench/test/request_receptor.h b/vbench/src/vbench/test/request_receptor.h index 2de39e528e4..0692c3735f6 100644 --- a/vbench/src/vbench/test/request_receptor.h +++ b/vbench/src/vbench/test/request_receptor.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once #include <vbench/core/handler.h> @@ -11,7 +10,7 @@ namespace vbench { struct RequestReceptor : public Handler<Request> { Request::UP request; RequestReceptor() : request() {} - virtual void handle(Request::UP req) override; + void handle(Request::UP req) override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/analyzer.h b/vbench/src/vbench/vbench/analyzer.h index e1bd8e23919..f206130cc0b 100644 --- a/vbench/src/vbench/vbench/analyzer.h +++ b/vbench/src/vbench/vbench/analyzer.h @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <memory> -#include <vbench/core/handler.h> - #include "request.h" +#include <vbench/core/handler.h> namespace vbench { @@ -18,4 +15,3 @@ struct Analyzer : public Handler<Request> }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/dropped_tagger.h b/vbench/src/vbench/vbench/dropped_tagger.h index eb64d4b4be4..a3fd7a65b99 100644 --- a/vbench/src/vbench/vbench/dropped_tagger.h +++ b/vbench/src/vbench/vbench/dropped_tagger.h @@ -1,11 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <vbench/core/handler.h> - #include "request.h" +#include <vbench/core/handler.h> namespace vbench { @@ -19,8 +17,7 @@ private: public: DroppedTagger(Handler<Request> &next); - virtual void handle(Request::UP request) override; + void handle(Request::UP request) override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/generator.h b/vbench/src/vbench/vbench/generator.h index 5eb8e056265..51309eaf9b6 100644 --- a/vbench/src/vbench/vbench/generator.h +++ b/vbench/src/vbench/vbench/generator.h @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <memory> -#include <vespa/vespalib/util/runnable.h> #include <vbench/core/taintable.h> +#include <vespa/vespalib/util/runnable.h> +#include <memory> namespace vbench { diff --git a/vbench/src/vbench/vbench/ignore_before.h b/vbench/src/vbench/vbench/ignore_before.h index d74a398efd8..a2786a0c340 100644 --- a/vbench/src/vbench/vbench/ignore_before.h +++ b/vbench/src/vbench/vbench/ignore_before.h @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <vbench/core/handler.h> #include "request.h" #include "analyzer.h" +#include <vbench/core/handler.h> namespace vbench { @@ -22,9 +21,8 @@ private: public: IgnoreBefore(double time, Handler<Request> &next); - virtual void handle(Request::UP request) override; - virtual void report() override; + void handle(Request::UP request) override; + void report() override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/latency_analyzer.cpp b/vbench/src/vbench/vbench/latency_analyzer.cpp index 32cd6387722..baefa0ab138 100644 --- a/vbench/src/vbench/vbench/latency_analyzer.cpp +++ b/vbench/src/vbench/vbench/latency_analyzer.cpp @@ -1,7 +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 "latency_analyzer.h" #include <cmath> diff --git a/vbench/src/vbench/vbench/latency_analyzer.h b/vbench/src/vbench/vbench/latency_analyzer.h index 499f6f3b991..162fa93a0a3 100644 --- a/vbench/src/vbench/vbench/latency_analyzer.h +++ b/vbench/src/vbench/vbench/latency_analyzer.h @@ -1,11 +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 <vbench/core/handler.h> -#include <vbench/core/string.h> -#include "request.h" #include "analyzer.h" namespace vbench { @@ -39,11 +35,10 @@ public: string toString() const; }; LatencyAnalyzer(Handler<Request> &next); - virtual void handle(Request::UP request) override; - virtual void report() override; + void handle(Request::UP request) override; + void report() override; void addLatency(double latency); Stats getStats() const; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/qps_analyzer.h b/vbench/src/vbench/vbench/qps_analyzer.h index 4b4b4997f62..10625a89762 100644 --- a/vbench/src/vbench/vbench/qps_analyzer.h +++ b/vbench/src/vbench/vbench/qps_analyzer.h @@ -1,10 +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 <vbench/core/handler.h> -#include "request.h" #include "analyzer.h" namespace vbench { @@ -24,10 +21,9 @@ private: public: QpsAnalyzer(Handler<Request> &next); - virtual void handle(Request::UP request) override; - virtual void report() override; + void handle(Request::UP request) override; + void report() override; void addEndTime(double end); }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/qps_tagger.h b/vbench/src/vbench/vbench/qps_tagger.h index 452ee8fb827..492ae324dc0 100644 --- a/vbench/src/vbench/vbench/qps_tagger.h +++ b/vbench/src/vbench/vbench/qps_tagger.h @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <vbench/core/handler.h> - -#include "request.h" #include "tagger.h" +#include "request.h" namespace vbench { @@ -22,8 +19,7 @@ private: public: QpsTagger(double qps, Handler<Request> &next); - virtual void handle(Request::UP request) override; + void handle(Request::UP request) override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/request.h b/vbench/src/vbench/vbench/request.h index 4951c96fbab..c3eab1ab75b 100644 --- a/vbench/src/vbench/vbench/request.h +++ b/vbench/src/vbench/vbench/request.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once #include <vbench/core/string.h> @@ -68,9 +67,9 @@ public: double latency() const { return (_endTime - _startTime); } - virtual void handleHeader(const string &name, const string &value) override; - virtual void handleContent(const Memory &data) override; - virtual void handleFailure(const string &reason) override; + void handleHeader(const string &name, const string &value) override; + void handleContent(const Memory &data) override; + void handleFailure(const string &reason) override; const BenchmarkHeaders &headers() const { return _headers; } @@ -78,4 +77,3 @@ public: }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/request_dumper.h b/vbench/src/vbench/vbench/request_dumper.h index aede956477c..a06e7224c4f 100644 --- a/vbench/src/vbench/vbench/request_dumper.h +++ b/vbench/src/vbench/vbench/request_dumper.h @@ -1,11 +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 <vbench/core/handler.h> - -#include "request.h" #include "analyzer.h" namespace vbench { @@ -21,9 +17,8 @@ private: public: RequestDumper(Handler<Request> &_next); - virtual void handle(Request::UP request) override; - virtual void report() override; + void handle(Request::UP request) override; + void report() override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/request_generator.h b/vbench/src/vbench/vbench/request_generator.h index 38f2c7ad7f8..ac2b18cf928 100644 --- a/vbench/src/vbench/vbench/request_generator.h +++ b/vbench/src/vbench/vbench/request_generator.h @@ -1,16 +1,12 @@ // 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/runnable.h> +#include "generator.h" +#include "request.h" #include <vbench/core/input_file_reader.h> -#include <vbench/core/taintable.h> #include <vbench/core/handler.h> -#include "request.h" -#include "generator.h" - namespace vbench { /** @@ -25,12 +21,10 @@ private: bool _aborted; public: - RequestGenerator(const string &inputFile, - Handler<Request> &next); + RequestGenerator(const string &inputFile, Handler<Request> &next); void abort() override; - virtual void run() override; - virtual const Taint &tainted() const override { return _input.tainted(); } + void run() override; + const Taint &tainted() const override { return _input.tainted(); } }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/request_scheduler.h b/vbench/src/vbench/vbench/request_scheduler.h index 1de61073d35..60fe4af12fc 100644 --- a/vbench/src/vbench/vbench/request_scheduler.h +++ b/vbench/src/vbench/vbench/request_scheduler.h @@ -1,23 +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 <memory> - -#include <vespa/vespalib/util/sync.h> -#include <vespa/vespalib/util/thread.h> -#include <vespa/vespalib/util/runnable.h> -#include <vespa/vespalib/util/active.h> - -#include <vbench/core/handler.h> +#include "worker.h" +#include "dropped_tagger.h" #include <vbench/core/time_queue.h> #include <vbench/core/dispatcher.h> #include <vbench/core/handler_thread.h> - -#include "request.h" -#include "worker.h" -#include "dropped_tagger.h" +#include <vespa/vespalib/util/sync.h> +#include <vespa/vespalib/util/active.h> namespace vbench { @@ -40,16 +31,15 @@ private: HttpConnectionPool _connectionPool; std::vector<Worker::UP> _workers; - virtual void run() override; + void run() override; public: typedef std::unique_ptr<RequestScheduler> UP; RequestScheduler(Handler<Request> &next, size_t numWorkers); void abort(); - virtual void handle(Request::UP request) override; - virtual void start() override; - virtual RequestScheduler &stop() override; - virtual void join() override; + void handle(Request::UP request) override; + void start() override; + RequestScheduler &stop() override; + void join() override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/request_sink.h b/vbench/src/vbench/vbench/request_sink.h index 37c6ce71fcc..9c9d46775e5 100644 --- a/vbench/src/vbench/vbench/request_sink.h +++ b/vbench/src/vbench/vbench/request_sink.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once #include "analyzer.h" @@ -15,9 +14,8 @@ class RequestSink : public Analyzer { public: RequestSink(); - virtual void handle(Request::UP request) override; - virtual void report() override; + void handle(Request::UP request) override; + void report() override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/server_tagger.h b/vbench/src/vbench/vbench/server_tagger.h index 6115873bb0c..5e760dc02e5 100644 --- a/vbench/src/vbench/vbench/server_tagger.h +++ b/vbench/src/vbench/vbench/server_tagger.h @@ -1,13 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <vbench/http/server_spec.h> -#include <vbench/core/handler.h> - -#include "request.h" #include "tagger.h" +#include <vbench/http/server_spec.h> namespace vbench { @@ -21,10 +17,8 @@ private: Handler<Request> &_next; public: - ServerTagger(const ServerSpec &server, - Handler<Request> &next); - virtual void handle(Request::UP request) override; + ServerTagger(const ServerSpec &server, Handler<Request> &next); + void handle(Request::UP request) override; }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/tagger.h b/vbench/src/vbench/vbench/tagger.h index c19319e39e2..225b83d5433 100644 --- a/vbench/src/vbench/vbench/tagger.h +++ b/vbench/src/vbench/vbench/tagger.h @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once -#include <memory> -#include <vbench/core/handler.h> - #include "request.h" +#include <vbench/core/handler.h> namespace vbench { @@ -17,4 +14,3 @@ struct Tagger : public Handler<Request> }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/vbench.h b/vbench/src/vbench/vbench/vbench.h index 5796b3dab76..186bdeeac17 100644 --- a/vbench/src/vbench/vbench/vbench.h +++ b/vbench/src/vbench/vbench/vbench.h @@ -1,14 +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 <memory> - -#include <vespa/vespalib/util/runnable.h> -#include <vbench/core/taintable.h> -#include <vespa/vespalib/data/slime/slime.h> - #include "analyzer.h" #include "generator.h" #include "latency_analyzer.h" @@ -20,6 +13,8 @@ #include "request_sink.h" #include "server_tagger.h" #include "tagger.h" +#include <vbench/core/taintable.h> +#include <vespa/vespalib/data/slime/slime.h> namespace vbench { @@ -42,9 +37,8 @@ private: public: VBench(const vespalib::Slime &cfg); void abort(); - virtual void run() override; - virtual const Taint &tainted() const override { return _taint; } + void run() override; + const Taint &tainted() const override { return _taint; } }; } // namespace vbench - diff --git a/vbench/src/vbench/vbench/worker.h b/vbench/src/vbench/vbench/worker.h index cdadaf87cd3..8e9a5119f31 100644 --- a/vbench/src/vbench/vbench/worker.h +++ b/vbench/src/vbench/vbench/worker.h @@ -1,19 +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 <memory> - -#include <vespa/vespalib/util/runnable.h> -#include <vespa/vespalib/util/thread.h> -#include <vespa/vespalib/util/joinable.h> - +#include "request.h" #include <vbench/core/provider.h> #include <vbench/core/handler.h> #include <vbench/http/http_connection_pool.h> - -#include "request.h" +#include <vespa/vespalib/util/runnable.h> +#include <vespa/vespalib/util/thread.h> +#include <vespa/vespalib/util/joinable.h> namespace vbench { @@ -33,13 +28,12 @@ private: HttpConnectionPool &_pool; Timer &_timer; - virtual void run() override; + void run() override; public: typedef std::unique_ptr<Worker> UP; Worker(Provider<Request> &provider, Handler<Request> &next, HttpConnectionPool &pool, Timer &timer); - virtual void join() override { _thread.join(); } + void join() override { _thread.join(); } }; } // namespace vbench - diff --git a/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp b/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp index 589d7b66e96..89879ef9d7a 100644 --- a/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp +++ b/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp @@ -1,7 +1,4 @@ // 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(".bucketdistributiontest"); #include <cppunit/extensions/HelperMacros.h> #include <vespa/vdslib/bucketdistribution.h> @@ -10,8 +7,6 @@ using namespace vdslib; class BucketDistributionTest : public CppUnit::TestFixture { public: - void setUp() override { } - void tearDown() override { } void testDistribution(); void testNumBucketBits(); @@ -29,7 +24,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(BucketDistributionTest); void BucketDistributionTest::testDistribution() { - LOG(info, "testDistribution"); const uint32_t expected4[] = { 10, 11, 9, 6, 4, 8, 14, 1, 13, 2, 12, 3, 5, 7, 15, 0 }; assertDistribution(16, 4, expected4); diff --git a/vdslib/src/tests/testrunner.cpp b/vdslib/src/tests/testrunner.cpp index fef61af9a17..0c5dcd1d00a 100644 --- a/vdslib/src/tests/testrunner.cpp +++ b/vdslib/src/tests/testrunner.cpp @@ -1,13 +1,12 @@ // 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> #include <vespa/vdstestlib/cppunit/cppunittestrunner.h> +#include <vespa/log/log.h> LOG_SETUP("vdslibcppunittestrunner"); int -main(int argc, char **argv) +main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/vdslib/src/tests/thread/taskschedulertest.cpp b/vdslib/src/tests/thread/taskschedulertest.cpp index 22529a9f37a..a48f9d20214 100644 --- a/vdslib/src/tests/thread/taskschedulertest.cpp +++ b/vdslib/src/tests/thread/taskschedulertest.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 <vespa/vdslib/thread/taskscheduler.h> #include <vespa/vdstestlib/cppunit/macros.h> diff --git a/vdstestlib/src/tests/cppunit/testrunner.cpp b/vdstestlib/src/tests/cppunit/testrunner.cpp index 1ba7be7790e..c25bee698d5 100644 --- a/vdstestlib/src/tests/cppunit/testrunner.cpp +++ b/vdstestlib/src/tests/cppunit/testrunner.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/vdstestlib/cppunit/cppunittestrunner.h> -int main(int argc, char **argv) +int main(int argc, const char *argv[]) { vdstestlib::CppUnitTestRunner testRunner; return testRunner.run(argc, argv); diff --git a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp b/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp index e00815241f0..73f6f3cc600 100644 --- a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp +++ b/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp @@ -1,15 +1,10 @@ // 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/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/vdstestlib/cppunit/dirconfig.h> - #include <fstream> #include <iostream> -#include <vespa/log/log.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/exceptions.h> - -LOG_SETUP("dirconfig_test"); using namespace vdstestlib; diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp index 7af156bbc2a..fb692bd8e8f 100644 --- a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp +++ b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp @@ -1,11 +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/vdstestlib/cppunit/cppunittestrunner.h> #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> -#include <cppunit/TestSuite.h> #include <cppunit/TextTestProgressListener.h> #include <vespa/log/log.h> #include <iostream> @@ -22,7 +20,7 @@ namespace { std::vector<std::string> _wanted; bool _includeStressTests; - WantedTestList(int argc, const char * const * argv, + WantedTestList(int argc, const char *argv[], bool includeStressTests) : _wanted(), _includeStressTests(includeStressTests) @@ -66,7 +64,7 @@ namespace { return (s[s.size() - 1] == '$'); } - virtual bool include(const std::string& name) const override { + bool include(const std::string& name) const override { if ((name.find("stress") != std::string::npos || name.find("Stress") != std::string::npos) && !_includeStressTests) @@ -90,11 +88,11 @@ namespace { struct LogHook : public CppUnit::TextTestProgressListener::TestStartHook { std::string lastTest; - virtual void startedTest(const std::string& testName) override { + void startedTest(const std::string& testName) override { LOG(info, "Starting test: %s", testName.c_str()); lastTest = testName; } - virtual void stoppedTest() override { + void stoppedTest() override { LOG(info, "Stopped test: %s", lastTest.c_str()); } }; @@ -112,7 +110,7 @@ CppUnitTestRunner::CppUnitTestRunner() } int -CppUnitTestRunner::run(int argc, const char * const * argv) +CppUnitTestRunner::run(int argc, const char *argv[]) { CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry& registry( diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.h b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.h index e8ee1700927..204cfff0cb8 100644 --- a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.h +++ b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.h @@ -50,7 +50,7 @@ public: CppUnitTestRunner(); void listTests(const CppUnit::TestSuite *tests); - int run(int argc, const char * const * argv); + int run(int argc, const char * argv[]); }; diff --git a/vespaclient/src/vespa/vespaclient/spoolmaster/application.h b/vespaclient/src/vespa/vespaclient/spoolmaster/application.h index 87f628e631c..2a20dd1b290 100644 --- a/vespaclient/src/vespa/vespaclient/spoolmaster/application.h +++ b/vespaclient/src/vespa/vespaclient/spoolmaster/application.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <vespa/fastos/app.h> #include <string> #include <vector> -#include <vespa/fastos/app.h> namespace spoolmaster { /** @@ -23,19 +23,9 @@ private: bool findOutboxes(); void moveLinks(); public: - /** - * Constructs a new spoolmaster object. - */ Application(); - - /** - * Destructor. Frees any allocated resources. - */ - virtual ~Application(); - - // Implements FastOS_Application. + ~Application(); int Main() override; }; } - diff --git a/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h b/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h index 2e50ffde2c0..fdb4129a188 100644 --- a/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h +++ b/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h @@ -17,7 +17,6 @@ private: bool printDocumentLocation(Locator &locator, const std::string &docId); public: - // Implements FastOS_Application. int Main() override; }; diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/application.h b/vespaclient/src/vespa/vespaclient/vesparoute/application.h index e7eefb7f16d..e77b70f1454 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/application.h +++ b/vespaclient/src/vespa/vespaclient/vesparoute/application.h @@ -64,13 +64,9 @@ private: std::vector<std::string> &oos, std::set<std::string> &errors) const; public: - /** Null member variables. */ Application(); ~Application(); - - // Inherit doc from FastOS_Application. int Main() override; }; } - diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h b/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h index f9737d1de9a..4c50ec9cb38 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h +++ b/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h @@ -21,11 +21,7 @@ public: // Overrides RPCNetwork. bool allocServiceAddress(mbus::RoutingNode &recipient) override; - - // Overrides RPCNetwork. void freeServiceAddress(mbus::RoutingNode &recipient) override; - - // Overrides RPCNetwork. void send(const mbus::Message &msg, const std::vector<mbus::RoutingNode*> &recipients) override; /** @@ -43,4 +39,3 @@ public: */ void removeNodes(std::vector<mbus::RoutingNode*> &nodes); }; - diff --git a/vespalib/src/vespa/vespalib/util/closure.h b/vespalib/src/vespa/vespalib/util/closure.h index 81ea8430609..a494c8d97df 100644 --- a/vespalib/src/vespa/vespalib/util/closure.h +++ b/vespalib/src/vespa/vespalib/util/closure.h @@ -102,9 +102,7 @@ class Closure0_2 : public Closure0<R> { T1 _arg1; T2 _arg2; - virtual R call() override - { return _func(std::move(_arg1), std::move(_arg2)); } - + R call() override { return _func(std::move(_arg1), std::move(_arg2)); } public: Closure0_2(Func func, T1 &&arg1, T2 &&arg2) : _func(func), _arg1(std::move(arg1)), _arg2(std::move(arg2)) {} @@ -120,8 +118,7 @@ class Closure0_3 : public Closure0<R> { T2 _arg2; T3 _arg3; - virtual R call() override - { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3)); } + R call() override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3)); } public: Closure0_3(Func func, T1 &&arg1, T2 &&arg2, T3 &&arg3) diff --git a/vespalib/src/vespa/vespalib/util/exception.h b/vespalib/src/vespa/vespalib/util/exception.h index af2f1bc225a..1ea1a9e5e61 100644 --- a/vespalib/src/vespa/vespalib/util/exception.h +++ b/vespalib/src/vespa/vespalib/util/exception.h @@ -6,7 +6,6 @@ #include <vespa/vespalib/util/macro.h> #include <vespa/vespalib/util/error.h> #include <vespa/vespalib/util/stringfmt.h> -#include <string> #include <exception> #define VESPALIB_EXCEPTION_USEBACKTRACES diff --git a/vespalog/src/logger/llreader.h b/vespalog/src/logger/llreader.h index 27b39d23df7..70b28d3996a 100644 --- a/vespalog/src/logger/llreader.h +++ b/vespalog/src/logger/llreader.h @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdexcept> -#include <vespa/log/log.h> -#include <vespa/log/log-target.h> #include <vespa/log/llparser.h> +#include <stdexcept> namespace ns_log { @@ -18,7 +16,6 @@ public: const char *what() const throw() override { return _string; } }; - class InputBuf { private: diff --git a/vespalog/src/test/threads/testthreads.cpp b/vespalog/src/test/threads/testthreads.cpp index 515fa10c11f..a708777f350 100644 --- a/vespalog/src/test/threads/testthreads.cpp +++ b/vespalog/src/test/threads/testthreads.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/fastos/app.h> +#include <vespa/fastos/time.h> #include <vespa/log/log.h> #include <iostream> -#include <string> using std::string; @@ -15,7 +15,7 @@ class FileThread : public FastOS_Runnable string _file; public: FileThread(string file) : _done(false), _file(file) {} - virtual void Run(FastOS_ThreadInterface *thread, void *arg) override; + void Run(FastOS_ThreadInterface *thread, void *arg) override; void stop() {_done = true; } }; @@ -25,13 +25,10 @@ class LoggerThread : public FastOS_Runnable public: bool _useLogBuffer; LoggerThread() : _done(false), _useLogBuffer(false) {} - virtual void Run(FastOS_ThreadInterface *thread, void *arg) override; + void Run(FastOS_ThreadInterface *thread, void *arg) override; void stop() {_done = true; } }; - - - void FileThread::Run(FastOS_ThreadInterface *, void *) { diff --git a/vespamalloc/src/tests/allocfree/allocfree.cpp b/vespamalloc/src/tests/allocfree/allocfree.cpp index cdb471e35d2..0806d3a8453 100644 --- a/vespamalloc/src/tests/allocfree/allocfree.cpp +++ b/vespamalloc/src/tests/allocfree/allocfree.cpp @@ -19,7 +19,7 @@ public: FreeWorker(uint32_t maxQueue, bool inverse) : Consumer (maxQueue, inverse) {} private: - virtual void consume(void * p) override { free(p); } + void consume(void * p) override { free(p); } }; //----------------------------------------------------------------------------- @@ -30,7 +30,7 @@ public: : Producer(cnt, target), _size(size) {} private: uint32_t _size; - virtual void * produce() override { return malloc(_size); } + void * produce() override { return malloc(_size); } }; //----------------------------------------------------------------------------- @@ -41,8 +41,9 @@ public: : ProducerConsumer(cnt, inverse), _size(size) { } private: uint32_t _size; - virtual void * produce() override { return malloc(_size); } - virtual void consume(void * p) override { free(p); } + + void * produce() override { return malloc(_size); } + void consume(void * p) override { free(p); } }; //----------------------------------------------------------------------------- diff --git a/vespamalloc/src/tests/allocfree/linklist.cpp b/vespamalloc/src/tests/allocfree/linklist.cpp index 06acfa8df8a..ff33fca4661 100644 --- a/vespamalloc/src/tests/allocfree/linklist.cpp +++ b/vespamalloc/src/tests/allocfree/linklist.cpp @@ -61,7 +61,7 @@ public: LinkIn(List::AtomicHeadPtr & list, uint32_t maxQueue, bool inverse); private: List::AtomicHeadPtr & _head; - virtual void consume(void * p) override { + void consume(void * p) override { List * l((List *) p); if ( ! ((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } List::linkIn(_head, l, l); @@ -82,7 +82,7 @@ public: : Producer(cnt, target), _head(list) {} private: List::AtomicHeadPtr & _head; - virtual void * produce() override { + void * produce() override { void *p = List::linkOut(_head); List *l((List *)p); if ( ! ((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } @@ -98,13 +98,13 @@ public: : ProducerConsumer(cnt, inverse), _head(list) { } private: List::AtomicHeadPtr & _head; - virtual void * produce() override { + void * produce() override { void *p = List::linkOut(_head); List *l((List *)p); if ( !((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } return p; } - virtual void consume(void * p) override { + void consume(void * p) override { List * l((List *) p); if ( !((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } List::linkIn(_head, l, l); diff --git a/vespamalloc/src/tests/doubledelete/expectsignal.cpp b/vespamalloc/src/tests/doubledelete/expectsignal.cpp index 3237339fb97..2811da01c09 100644 --- a/vespamalloc/src/tests/doubledelete/expectsignal.cpp +++ b/vespamalloc/src/tests/doubledelete/expectsignal.cpp @@ -9,7 +9,8 @@ class Test : public TestApp public: int Main() override; private: - virtual bool useProcessStarter() const override { return true; } + bool useProcessStarter() const override { return true; } + }; int Test::Main() diff --git a/vespamalloc/src/tests/test.cpp b/vespamalloc/src/tests/test.cpp index 9f5bd826a6b..960114b1bc1 100644 --- a/vespamalloc/src/tests/test.cpp +++ b/vespamalloc/src/tests/test.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 <stdio.h> -#include <stdlib.h> + #include <vespa/fastos/thread.h> namespace vespamalloc { diff --git a/vespamalloc/src/tests/thread/racemanythreads.cpp b/vespamalloc/src/tests/thread/racemanythreads.cpp index 8f366acea3a..acfefceee15 100644 --- a/vespamalloc/src/tests/thread/racemanythreads.cpp +++ b/vespamalloc/src/tests/thread/racemanythreads.cpp @@ -1,17 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <pthread.h> -#include <stdint.h> -#include <errno.h> -#include <vespa/vespalib/util/atomic.h> -#include <sys/resource.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> -LOG_SETUP("thread_test"); +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/atomic.h> using namespace vespalib; diff --git a/vespamalloc/src/tests/thread/thread.cpp b/vespamalloc/src/tests/thread/thread.cpp index 6261a0f8eb6..9053a435d11 100644 --- a/vespamalloc/src/tests/thread/thread.cpp +++ b/vespamalloc/src/tests/thread/thread.cpp @@ -1,17 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <pthread.h> -#include <stdint.h> -#include <errno.h> -#include <vespa/vespalib/util/atomic.h> -#include <sys/resource.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/log/log.h> -LOG_SETUP("thread_test"); +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/atomic.h> using namespace vespalib; @@ -21,7 +11,7 @@ public: ~Test(); int Main() override; private: - virtual bool useIPCHelper() const override { return true; } + bool useIPCHelper() const override { return true; } }; Test::~Test() |