diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2016-11-04 13:05:08 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2016-11-04 13:05:08 +0000 |
commit | 28d80634f49ca5fc9d4f7df15c357ee2a9b34b87 (patch) | |
tree | 34f035879d7b649655ff0ee209f19aa359bb413e /searchcore | |
parent | 8e97d41a730d82e89a39d46f939e5ad976349deb (diff) |
Move HwInfo from vespalib to searchcore and simplify code.
Diffstat (limited to 'searchcore')
26 files changed, 103 insertions, 89 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index a988ed99ace..3879d26a371 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -19,7 +19,7 @@ LOG_SETUP("persistenceconformance_test"); #include <vespa/searchlib/transactionlog/translogserver.h> #include <tests/proton/common/dummydbowner.h> #include <vespa/vespalib/io/fileutil.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using namespace config; using namespace proton; @@ -190,7 +190,7 @@ public: docType.toString()), std::make_shared<vespalib::ThreadStackExecutor> (16, 128 * 1024), - std::make_shared<vespalib::MockHwInfo>())); + HwInfo())); } }; diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 62d4e0823eb..6e6df7cc5e3 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -30,7 +30,7 @@ LOG_SETUP("attribute_manager_test"); #include <vespa/searchlib/attribute/singlenumericattribute.hpp> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/vespalib/util/threadstackexecutor.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/config-attributes.h> namespace vespa { namespace config { namespace search {}}} @@ -107,12 +107,12 @@ struct BaseFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; BaseFixture() : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()) + _hwInfo() { } }; diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp index 1f69d9136cf..18942216647 100644 --- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp @@ -11,7 +11,7 @@ LOG_SETUP("attribute_populator_test"); #include <vespa/searchlib/index/docbuilder.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/vespalib/util/stringfmt.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> using namespace document; @@ -56,7 +56,7 @@ struct Fixture test::DirectoryHandler _testDir; DummyFileHeaderContext _fileHeader; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; AttributeManager::SP _mgr; AttributePopulator _pop; DocContext _ctx; @@ -64,7 +64,7 @@ struct Fixture : _testDir(TEST_DIR), _fileHeader(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeader, _attributeFieldWriter, _hwInfo)), diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index c8676efd551..89f27e8cc77 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -19,7 +19,7 @@ LOG_SETUP("attribute_test"); #include <vespa/searchlib/index/docbuilder.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/util/filekit.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/document/predicate/predicate_slime_builder.h> @@ -103,7 +103,7 @@ struct Fixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; proton::AttributeManager::SP _m; AttributeWriter aw; @@ -111,7 +111,7 @@ struct Fixture : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _m(std::make_shared<proton::AttributeManager> (test_dir, "test.subdb", TuneFileAttributes(), _fileHeaderContext, _attributeFieldWriter, _hwInfo)), @@ -530,7 +530,7 @@ struct FilterFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; proton::AttributeManager::SP _baseMgr; FilterAttributeManager _filterMgr; @@ -538,7 +538,7 @@ struct FilterFixture : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _baseMgr(new proton::AttributeManager(test_dir, "test.subdb", TuneFileAttributes(), _fileHeaderContext, diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 2d43e0b06db..ecd80358f5b 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -16,7 +16,7 @@ LOG_SETUP("attributeflush_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/searchcore/proton/test/directory_handler.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchlib/attribute/attributevector.hpp> using namespace document; @@ -217,7 +217,7 @@ private: void requireThatShrinkWorks(); - void requireThatFlushedAttributeCanBeLoaded(std::shared_ptr<vespalib::IHwInfo> hwInfo); + void requireThatFlushedAttributeCanBeLoaded(const HwInfo &hwInfo); void requireThatFlushedAttributeCanBeLoaded(); public: int @@ -232,15 +232,15 @@ struct BaseFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; BaseFixture() : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()) + _hwInfo() { } - BaseFixture(const std::shared_ptr<IHwInfo> &hwInfo) + BaseFixture(const HwInfo &hwInfo) : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), @@ -280,7 +280,7 @@ struct Fixture : public BaseFixture, public AttributeManagerFixture AttributeManagerFixture(*static_cast<BaseFixture *>(this)) { } - Fixture(const std::shared_ptr<IHwInfo> &hwInfo) + Fixture(const HwInfo &hwInfo) : BaseFixture(hwInfo), AttributeManagerFixture(*static_cast<BaseFixture *>(this)) { @@ -560,11 +560,11 @@ Test::requireThatShrinkWorks() } void -Test::requireThatFlushedAttributeCanBeLoaded(std::shared_ptr<vespalib::IHwInfo> hwInfo) +Test::requireThatFlushedAttributeCanBeLoaded(const HwInfo &hwInfo) { constexpr uint32_t numDocs = 100; BaseFixture f(hwInfo); - vespalib::string attrName(hwInfo->spinningDisk() ? "a11spin" : "a11ssd"); + vespalib::string attrName(hwInfo.slowDisk() ? "a11slow" : "a11fast"); { AttributeManagerFixture amf(f); AttributeManager &am = amf._m; @@ -593,8 +593,8 @@ Test::requireThatFlushedAttributeCanBeLoaded(std::shared_ptr<vespalib::IHwInfo> void Test::requireThatFlushedAttributeCanBeLoaded() { - TEST_DO(requireThatFlushedAttributeCanBeLoaded(std::make_shared<vespalib::MockHwInfo>(false))); - TEST_DO(requireThatFlushedAttributeCanBeLoaded(std::make_shared<vespalib::MockHwInfo>(true))); + TEST_DO(requireThatFlushedAttributeCanBeLoaded(HwInfo(false))); + TEST_DO(requireThatFlushedAttributeCanBeLoaded(HwInfo(true))); } int diff --git a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp index b7089623e97..4047a02121c 100644 --- a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp @@ -11,7 +11,7 @@ LOG_SETUP("attributes_state_explorer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/vespalib/test/insertion_operators.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using namespace proton; using namespace proton::test; @@ -27,14 +27,14 @@ struct Fixture DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; AttributeManager::SP _mgr; AttributeManagerExplorer _explorer; Fixture() : _dirHandler(TEST_DIR), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, _attributeFieldWriter, diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 8d71bba6841..ef3806d04c0 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -24,7 +24,7 @@ LOG_SETUP("docsummary_test"); #include <vespa/vespalib/tensor/tensor_factory.h> #include <vespa/vespalib/tensor/default_tensor.h> #include <vespa/searchlib/tensor/tensor_attribute.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using namespace document; using namespace search; @@ -144,7 +144,7 @@ public: DocumentDBConfig::DocumenttypesConfigSP _documenttypesConfig; const DocumentTypeRepo::SP _repo; TuneFileDocumentDB::SP _tuneFileDocumentDB; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; std::unique_ptr<DocumentDB> _ddb; AttributeWriter::UP _aw; ISummaryAdapter::SP _sa; @@ -163,7 +163,7 @@ public: _documenttypesConfig(new DocumenttypesConfig()), _repo(repo), _tuneFileDocumentDB(new TuneFileDocumentDB()), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _ddb(), _aw(), _sa() diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 556e10a7a6c..974efcdef6a 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -24,7 +24,7 @@ LOG_SETUP("configurer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/transactionlog/nosyncproxy.h> #include <vespa/vespalib/io/fileutil.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using namespace config; using namespace document; @@ -94,7 +94,7 @@ struct ViewSet CommitTimeTracker _commitTimeTracker; VarHolder<SearchView::SP> searchView; VarHolder<SearchableFeedView::SP> feedView; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; ViewSet() : _reconfigurer(), _fileHeaderContext(), @@ -110,7 +110,7 @@ struct ViewSet _commitTimeTracker(TimeStamp()), searchView(), feedView(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()) + _hwInfo() { } @@ -252,7 +252,7 @@ struct MyFastAccessFeedView DummyFileHeaderContext _fileHeaderContext; DocIdLimit _docIdLimit; IThreadingService &_writeService; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; IDocumentMetaStoreContext::SP _dmsc; std::unique_ptr<documentmetastore::ILidReuseDelayer> _lidReuseDelayer; @@ -264,7 +264,7 @@ struct MyFastAccessFeedView _fileHeaderContext(), _docIdLimit(0), _writeService(writeService), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _dmsc(), _lidReuseDelayer(), _commitTimeTracker(TimeStamp()), diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index d72ddc5a2a8..152b1f5cf29 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -21,7 +21,7 @@ LOG_SETUP("document_subdbs_test"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <iostream> @@ -128,7 +128,7 @@ struct MyStoreOnlyContext MyFileHeaderContext _fileHeader; LegacyDocumentDBMetrics _metrics; vespalib::Lock _configLock; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; StoreOnlyContext _ctx; MyStoreOnlyContext(IThreadingService &writeService, ThreadStackExecutorBase &summaryExecutor, @@ -141,7 +141,7 @@ struct MyStoreOnlyContext _fileHeader(), _metrics(DOCTYPE_NAME, 1), _configLock(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _ctx(_owner, _syncProxy, _getSerialNum, diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index 125127d5af9..aabff1f35d1 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -21,7 +21,7 @@ LOG_SETUP("documentdb_test"); #include <vespa/searchlib/transactionlog/translogserver.h> #include <tests/proton/common/dummydbowner.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using document::DocumentType; using document::DocumentTypeRepo; @@ -57,7 +57,7 @@ struct Fixture { DummyWireService _dummy; DummyDBOwner _dummyDBOwner; vespalib::ThreadStackExecutor _summaryExecutor; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; DocumentDB::SP _db; DummyFileHeaderContext _fileHeaderContext; TransLogServer _tls; @@ -71,7 +71,7 @@ Fixture::Fixture() : _dummy(), _dummyDBOwner(), _summaryExecutor(8, 128*1024), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _db(), _fileHeaderContext(), _tls("tmp", 9014, ".", _fileHeaderContext), diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index cc77eb63c29..df2758eab1b 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -17,7 +17,7 @@ LOG_SETUP("documentmetastore_test"); #include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/searchcore/proton/server/itlssyncer.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using namespace document; using search::AttributeVector; @@ -1833,8 +1833,7 @@ TEST("requireThatShrinkViaFlushTargetWorks") TuneFileAttributes tuneFileAttributes; DummyFileHeaderContext fileHeaderContext; DummyTlsSyncer dummyTlsSyncer; - std::shared_ptr<vespalib::IHwInfo> hwInfo = - std::make_shared<vespalib::MockHwInfo>(); + HwInfo hwInfo; vespalib::rmdir("dmsflush", true); vespalib::mkdir("dmsflush"); IFlushTarget::SP ft(new DocumentMetaStoreFlushTarget(dms, diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index ebd5107f0a5..44eb1353637 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -13,7 +13,7 @@ LOG_SETUP("attribute_reprocessing_initializer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/mock_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> using namespace proton; @@ -53,14 +53,14 @@ struct MyConfig { DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; AttributeManager::SP _mgr; search::index::Schema _schema; MyDocTypeInspector::SP _inspector; MyConfig() : _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, _attributeFieldWriter, _hwInfo)), @@ -97,7 +97,7 @@ struct Fixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; AttributeManager::SP _mgr; MyConfig _oldCfg; MyConfig _newCfg; @@ -107,7 +107,7 @@ struct Fixture : _dirHandler(TEST_DIR), _fileHeaderContext(), _attributeFieldWriter(), - _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _hwInfo(), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, _attributeFieldWriter, _hwInfo)), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index f53e6995410..ecc68558f50 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -12,7 +12,7 @@ LOG_SETUP(".proton.attribute.attributemanager"); #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/data/fileheader.h> -#include <vespa/vespalib/util/i_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchlib/attribute/interlock.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <memory> @@ -180,7 +180,7 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, const FileHeaderContext &fileHeaderContext, search::ISequencedTaskExecutor & attributeFieldWriter, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : proton::IAttributeManager(), _attributes(), _flushables(), @@ -205,7 +205,7 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, search::ISequencedTaskExecutor & attributeFieldWriter, const IAttributeFactory::SP &factory, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : proton::IAttributeManager(), _attributes(), _flushables(), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h index 5dad0ca0cef..cbefeff8e7e 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h @@ -11,8 +11,7 @@ #include <vespa/searchcore/proton/attribute/flushableattribute.h> #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchcommon/common/schema.h> - -namespace vespalib { class IHwInfo; } +#include <vespa/searchcore/proton/common/hw_info.h> namespace search { @@ -29,7 +28,6 @@ class FileHeaderContext; namespace proton { - /** * Specialized attribute manager for proton. */ @@ -66,7 +64,7 @@ private: IAttributeFactory::SP _factory; std::shared_ptr<search::attribute::Interlock> _interlock; search::ISequencedTaskExecutor &_attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; search::AttributeVector::SP internalAddAttribute(const vespalib::string &name, const Config &cfg, @@ -104,7 +102,7 @@ public: const search::common::FileHeaderContext & fileHeaderContext, search::ISequencedTaskExecutor &attributeFieldWriter, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); AttributeManager(const vespalib::string &baseDir, const vespalib::string &documentSubDbName, @@ -113,7 +111,7 @@ public: fileHeaderContext, search::ISequencedTaskExecutor &attributeFieldWriter, const IAttributeFactory::SP &factory, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); AttributeManager(const AttributeManager &currMgr, const Spec &newSpec, diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index d84f44d5ffd..3be2064835f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -12,7 +12,7 @@ LOG_SETUP(".proton.attribute.flushableattribute"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/closuretask.h> -#include <vespa/vespalib/util/i_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <fstream> #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> @@ -76,7 +76,7 @@ FlushableAttribute::Flusher::saveAttribute() _syncToken); bool saveSuccess = true; if (_saver && _saver->hasGenerationGuard() && - _fattr._hwInfo->spinningDisk()) { + _fattr._hwInfo.slowDisk()) { saveSuccess = _saver->save(_saveTarget); _saver.reset(); } @@ -171,7 +171,7 @@ FlushableAttribute::FlushableAttribute(const AttributeVector::SP attr, fileHeaderContext, search::ISequencedTaskExecutor & attributeFieldWriter, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : IFlushTarget(vespalib::make_string( "attribute.%s", attr->getName().c_str()), diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h index a400176ec3e..d2e105a8e7e 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h @@ -6,10 +6,9 @@ #include <vespa/searchlib/attribute/attributememorysavetarget.h> #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/common/indexmetainfo.h> +#include <vespa/searchcore/proton/common/hw_info.h> -namespace vespalib { class IHwInfo; } - namespace search { @@ -77,7 +76,7 @@ private: const search::common::FileHeaderContext &_fileHeaderContext; fastos::TimeStamp _lastFlushTime; search::ISequencedTaskExecutor &_attributeFieldWriter; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; Task::UP internalInitFlush(SerialNum currentSerial); @@ -96,7 +95,7 @@ public: const search::common::FileHeaderContext & fileHeaderContext, search::ISequencedTaskExecutor &attributeFieldWriter, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); virtual ~FlushableAttribute(); diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info.h b/searchcore/src/vespa/searchcore/proton/common/hw_info.h new file mode 100644 index 00000000000..5b5a1d500d2 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info.h @@ -0,0 +1,27 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +namespace proton { + +/* + * Class describing some hardware on the machine. + */ +class HwInfo +{ + bool _slowDisk; +public: + HwInfo() + : _slowDisk(false) + { + } + + HwInfo(bool slowDisk_in) + : _slowDisk(slowDisk_in) + { + } + + bool slowDisk() const { return _slowDisk; } +}; + +} diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp index 40ecd54314d..b189b176b80 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp @@ -13,7 +13,7 @@ LOG_SETUP(".proton.documentmetastore.documentmetastoreflushtarget"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/closuretask.h> -#include <vespa/vespalib/util/i_hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <fstream> #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchcore/proton/server/itlssyncer.h> @@ -72,7 +72,7 @@ DocumentMetaStoreFlushTarget::Flusher::saveDocumentMetaStore() SerialNumFileHeaderContext fileHeaderContext(_dmsft._fileHeaderContext, _syncToken); bool saveSuccess = false; - if (_dmsft._hwInfo->spinningDisk()) { + if (_dmsft._hwInfo.slowDisk()) { search::AttributeMemorySaveTarget memorySaveTarget; saveSuccess = _saver->save(memorySaveTarget); _saver.reset(); @@ -170,7 +170,7 @@ DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, const vespalib::string & baseDir, const TuneFileAttributes &tuneFileAttributes, const FileHeaderContext &fileHeaderContext, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : IFlushTarget("documentmetastore", Type::SYNC, Component::ATTRIBUTE), _dms(dms), _tlsSyncer(tlsSyncer), diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h index 66b7da80697..d26c55906e2 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h @@ -7,8 +7,7 @@ #include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchlib/common/tunefileinfo.h> #include "documentmetastore.h" - -namespace vespalib { class IHwInfo; } +#include <vespa/searchcore/proton/common/hw_info.h> namespace search { @@ -76,7 +75,7 @@ private: const search::TuneFileAttributes _tuneFileAttributes; const search::common::FileHeaderContext &_fileHeaderContext; fastos::TimeStamp _lastFlushTime; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; static vespalib::string getSnapshotName(uint64_t syncToken); @@ -98,7 +97,7 @@ public: tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); virtual ~DocumentMetaStoreFlushTarget(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 2dfe50da10f..294892d06c1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -88,7 +88,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, const FileHeaderContext &fileHeaderContext, ConfigStore::UP config_store, InitializeThreads initializeThreads, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : IDocumentDBConfigOwner(), IReplayConfig(), FeedHandler::IOwner(), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 5bf8bfebf41..2ce28c9153e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -41,8 +41,6 @@ using vespa::config::search::core::ProtonConfig; -namespace vespalib { class IHwInfo; } - namespace search { @@ -273,7 +271,7 @@ public: const search::common::FileHeaderContext &fileHeaderContext, ConfigStore::UP config_store, InitializeThreads initializeThreads, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); /** * Expose a cost view of the session manager. This is used by the diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 643cfe7d87f..2bf85281ccc 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -39,7 +39,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( vespalib::Lock &configLock, const vespalib::string &baseDir, const ProtonConfig &protonCfg, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : _subDBs(), _calc(), _readySubDbId(0), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 1ed63648702..4e3e32c2c4c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -16,8 +16,6 @@ #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/initializer/initializer_task.h> -namespace vespalib { class IHwInfo; } - namespace proton { class DocumentDBConfig; class LegacyDocumentDBMetrics; @@ -62,7 +60,7 @@ public: vespalib::Lock &configLock, const vespalib::string &baseDir, const vespa::config::search::core::ProtonConfig &protonCfg, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo); + const HwInfo &hwInfo); ~DocumentSubDBCollection(); void setBucketStateCalculator(const IBucketStateCalculator::SP &calc) { diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 81abec94a8a..f14b4efc1d8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -34,7 +34,7 @@ LOG_SETUP(".proton.server.proton"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/random.h> -#include <vespa/vespalib/util/hw_info.h> +#include <vespa/searchcore/proton/common/hw_info.h> using document::DocumentTypeRepo; using vespalib::FileHeader; @@ -210,7 +210,7 @@ Proton::Proton(const config::ConfigUri & configUri, _initStarted(false), _initComplete(false), _initDocumentDbsInSequence(false), - _hwInfo(std::make_shared<vespalib::HwInfo>()) + _hwInfo() { } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index f422edd00c1..cf551c13748 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -32,8 +32,6 @@ #include <vespa/vespalib/util/rwlock.h> #include <vespa/vespalib/util/varholder.h> -namespace vespalib { class IHwInfo; } - namespace proton { @@ -142,7 +140,7 @@ private: bool _initStarted; bool _initComplete; bool _initDocumentDbsInSequence; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; bool performDataDirectoryUpgrade(const vespalib::string &baseDir); void loadLibrary(const vespalib::string &libName); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 0b2b46368dc..49e8a03c8ec 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -23,8 +23,6 @@ #include <vespa/vespalib/util/varholder.h> -namespace vespalib { class IHwInfo; } - namespace proton { @@ -149,7 +147,7 @@ public: bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; LegacyDocumentDBMetrics &_metrics; vespalib::Lock &_configLock; - const std::shared_ptr<vespalib::IHwInfo> &_hwInfo; + const HwInfo &_hwInfo; Context(IDocumentSubDB::IOwner &owner, search::transactionlog::SyncProxy &tlSyncer, @@ -162,7 +160,7 @@ public: bucketDBHandlerInitializer, LegacyDocumentDBMetrics &metrics, vespalib::Lock &configLock, - const std::shared_ptr<vespalib::IHwInfo> &hwInfo) + const HwInfo &hwInfo) : _owner(owner), _tlSyncer(tlSyncer), _getSerialNum(getSerialNum), @@ -204,7 +202,7 @@ protected: vespalib::VarHolder<ISearchHandler::SP> _iSearchView; vespalib::VarHolder<IFeedView::SP> _iFeedView; vespalib::Lock &_configLock; - std::shared_ptr<vespalib::IHwInfo> _hwInfo; + HwInfo _hwInfo; private: const IGetSerialNum &_getSerialNum; TlsSyncer _tlsSyncer; |