diff options
author | Geir Storli <geirst@yahoo-inc.com> | 2017-03-07 13:50:41 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahoo-inc.com> | 2017-03-07 13:50:41 +0000 |
commit | f6c8ae09fc5959124408fcf1025d66a52c8be84d (patch) | |
tree | 93bcddbe4236a966ed9a1438eafadb435da7a3c3 | |
parent | 12d429744ccdf13c2ff5aa6d343b7b823d93b33d (diff) |
Rename *referent* -> *reference* to align with naming elsewhere (e.g. config-model).
35 files changed, 294 insertions, 296 deletions
diff --git a/searchcore/CMakeLists.txt b/searchcore/CMakeLists.txt index 917720b3bca..d9aeeada520 100644 --- a/searchcore/CMakeLists.txt +++ b/searchcore/CMakeLists.txt @@ -124,8 +124,8 @@ vespa_define_module( src/tests/proton/reference/gid_to_lid_change_listener src/tests/proton/reference/gid_to_lid_change_registrator src/tests/proton/reference/gid_to_lid_mapper + src/tests/proton/reference/document_db_reference_registry src/tests/proton/reference/document_db_reference_resolver - src/tests/proton/reference/document_db_referent_registry src/tests/proton/reprocessing/attribute_reprocessing_initializer src/tests/proton/reprocessing/document_reprocessing_handler src/tests/proton/reprocessing/reprocessing_runner diff --git a/searchcore/src/tests/proton/common/dummydbowner.h b/searchcore/src/tests/proton/common/dummydbowner.h index a514f0ae9a7..8f44985d619 100644 --- a/searchcore/src/tests/proton/common/dummydbowner.h +++ b/searchcore/src/tests/proton/common/dummydbowner.h @@ -3,7 +3,7 @@ #pragma once #include <vespa/searchcore/proton/server/idocumentdbowner.h> -#include <vespa/searchcore/proton/reference/document_db_referent_registry.h> +#include <vespa/searchcore/proton/reference/document_db_reference_registry.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/vespalib/stllike/string.h> @@ -11,10 +11,10 @@ namespace proton { struct DummyDBOwner : IDocumentDBOwner { - std::shared_ptr<IDocumentDBReferentRegistry> _registry; + std::shared_ptr<IDocumentDBReferenceRegistry> _registry; DummyDBOwner() - : _registry(std::make_shared<DocumentDBReferentRegistry>()) + : _registry(std::make_shared<DocumentDBReferenceRegistry>()) { } @@ -25,7 +25,7 @@ struct DummyDBOwner : IDocumentDBOwner { return searchcorespi::IIndexManagerFactory::SP(); } uint32_t getDistributionKey() const override { return -1; } - std::shared_ptr<IDocumentDBReferentRegistry> getDocumentDBReferentRegistry() const override { + std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override { return _registry; } }; diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index 020f7696a7a..473fcba8051 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -14,8 +14,8 @@ #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> -#include <vespa/searchcore/proton/reference/document_db_referent_registry.h> -#include <vespa/searchcore/proton/reference/i_document_db_referent.h> +#include <vespa/searchcore/proton/reference/document_db_reference_registry.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference.h> #include <vespa/searchcorespi/index/indexflushtarget.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/transactionlog/translogserver.h> @@ -56,13 +56,13 @@ public: struct MyDBOwner : public DummyDBOwner { - std::shared_ptr<DocumentDBReferentRegistry> _registry; + std::shared_ptr<DocumentDBReferenceRegistry> _registry; MyDBOwner() : DummyDBOwner(), - _registry(std::make_shared<DocumentDBReferentRegistry>()) + _registry(std::make_shared<DocumentDBReferenceRegistry>()) { } - std::shared_ptr<IDocumentDBReferentRegistry> getDocumentDBReferentRegistry() const override { + std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override { return _registry; } }; @@ -234,12 +234,12 @@ TEST_F("require that session manager can be explored", Fixture) EXPECT_TRUE(DocumentDBExplorer(f._db).get_child("session").get() != nullptr); } -TEST_F("require that document db registers referent", Fixture) +TEST_F("require that document db registers reference", Fixture) { auto ®istry = f._myDBOwner._registry; - auto referent = registry->get("typea"); - EXPECT_TRUE(referent.get() != nullptr); - auto attr = referent->getAttribute("attr1"); + auto reference = registry->get("typea"); + EXPECT_TRUE(reference.get() != nullptr); + auto attr = reference->getAttribute("attr1"); EXPECT_TRUE(attr.get() != nullptr); EXPECT_EQUAL(search::attribute::BasicType::INT32, attr->getBasicType()); } diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/CMakeLists.txt b/searchcore/src/tests/proton/reference/document_db_reference_registry/CMakeLists.txt new file mode 100644 index 00000000000..1e5df364443 --- /dev/null +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +vespa_add_executable(searchcore_document_db_reference_registry_test_app TEST + SOURCES + document_db_reference_registry_test.cpp + DEPENDS + searchcore_reference + searchcore_documentmetastore + searchcore_bucketdb +) +vespa_add_test(NAME searchcore_document_db_reference_registry_test_app COMMAND searchcore_document_db_reference_registry_test_app) diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/DESC b/searchcore/src/tests/proton/reference/document_db_reference_registry/DESC new file mode 100644 index 00000000000..a71a62917f1 --- /dev/null +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/DESC @@ -0,0 +1 @@ +document_db_reference_registry test. Take a look at document_db_reference_registry_test.cpp for details. diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/FILES b/searchcore/src/tests/proton/reference/document_db_reference_registry/FILES new file mode 100644 index 00000000000..3a00650715a --- /dev/null +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/FILES @@ -0,0 +1 @@ +document_db_reference_registry_test.cpp diff --git a/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp new file mode 100644 index 00000000000..26a2f38e640 --- /dev/null +++ b/searchcore/src/tests/proton/reference/document_db_reference_registry/document_db_reference_registry_test.cpp @@ -0,0 +1,94 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/stllike/string.h> +#include <vespa/searchcore/proton/reference/document_db_reference_registry.h> +#include <vespa/searchcore/proton/test/mock_document_db_reference.h> +#include <thread> +#include <vespa/log/log.h> +LOG_SETUP("document_db_reference_registry_test"); + +namespace proton +{ + +namespace +{ + + +std::mutex lock; +std::shared_ptr<IDocumentDBReference> getFooResult; + +void getFooTask(const IDocumentDBReferenceRegistry *registry) +{ + auto result = registry->get("foo"); + std::lock_guard<std::mutex> guard(lock); + getFooResult = result; +} + +std::shared_ptr<IDocumentDBReference> checkFooResult() +{ + std::lock_guard<std::mutex> guard(lock); + return getFooResult; +} + +} + +struct Fixture +{ + DocumentDBReferenceRegistry _registry; + + Fixture() + : _registry() + { + } + + test::MockDocumentDBReference::SP + add(vespalib::string name) { + auto reference = std::make_shared<test::MockDocumentDBReference>(); + _registry.add(name, reference); + return reference; + } +}; + +TEST_F("Test that we can instantiate registry with two references", Fixture) +{ + auto referenceFoo = f.add("foo"); + auto referenceBar = f.add("bar"); + EXPECT_NOT_EQUAL(referenceFoo.get(), referenceBar.get()); + auto reference = f._registry.get("foo"); + EXPECT_EQUAL(referenceFoo.get(), reference.get()); + reference = f._registry.get("bar"); + EXPECT_EQUAL(referenceBar.get(), reference.get()); +} + +TEST_F("Test that we block get until related add is completed", Fixture) +{ + const IDocumentDBReferenceRegistry ®istry = f._registry; + std::thread getFooThread(getFooTask, ®istry); + sleep(1); + std::shared_ptr<IDocumentDBReference> nullResult; + EXPECT_EQUAL(nullResult.get(), checkFooResult().get()); + auto referenceFoo = f.add("foo"); + std::shared_ptr<IDocumentDBReference> checkResult; + for (int retry = 0; retry < 60 && !checkResult; ++retry) { + sleep(1); + checkResult = checkFooResult(); + } + EXPECT_EQUAL(referenceFoo.get(), checkResult.get()); + getFooThread.join(); +} + +TEST_F("Test that tryGet method can fail", Fixture) +{ + auto referenceFoo = f.add("foo"); + auto reference = f._registry.tryGet("foo"); + EXPECT_EQUAL(referenceFoo.get(), reference.get()); + reference = f._registry.tryGet("bar"); + EXPECT_TRUE(reference.get() == nullptr); +} + +} + +TEST_MAIN() +{ + TEST_RUN_ALL(); +} diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index 187106a9818..15668427c03 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -9,10 +9,10 @@ #include <vespa/searchcore/proton/common/monitored_refcount.h> #include <vespa/searchcore/proton/reference/document_db_reference_resolver.h> #include <vespa/searchcore/proton/reference/gid_to_lid_change_listener.h> -#include <vespa/searchcore/proton/reference/i_document_db_referent.h> -#include <vespa/searchcore/proton/reference/i_document_db_referent_registry.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h> #include <vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h> -#include <vespa/searchcore/proton/test/mock_document_db_referent.h> +#include <vespa/searchcore/proton/test/mock_document_db_reference.h> #include <vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> @@ -29,7 +29,7 @@ using namespace document; using namespace proton; using namespace search::attribute; using namespace search; -using proton::test::MockDocumentDBReferent; +using proton::test::MockDocumentDBReference; using search::attribute::test::MockAttributeManager; using vespa::config::search::ImportedFieldsConfig; using vespa::config::search::ImportedFieldsConfigBuilder; @@ -51,15 +51,15 @@ using proton::test::MockGidToLidChangeHandler; using AddEntry = MockGidToLidChangeHandler::AddEntry; using RemoveEntry = MockGidToLidChangeHandler::RemoveEntry; -struct MyDocumentDBReferent : public MockDocumentDBReferent { - using SP = std::shared_ptr<MyDocumentDBReferent>; +struct MyDocumentDBReference : public MockDocumentDBReference { + using SP = std::shared_ptr<MyDocumentDBReference>; using AttributesMap = std::map<vespalib::string, AttributeVector::SP>; MyGidToLidMapperFactory::SP factory; AttributesMap attributes; std::shared_ptr<MockGidToLidChangeHandler> _gidToLidChangeHandler; - MyDocumentDBReferent(MyGidToLidMapperFactory::SP factory_, - std::shared_ptr<MockGidToLidChangeHandler> gidToLidChangeHandler) + MyDocumentDBReference(MyGidToLidMapperFactory::SP factory_, + std::shared_ptr<MockGidToLidChangeHandler> gidToLidChangeHandler) : factory(factory_), _gidToLidChangeHandler(std::move(gidToLidChangeHandler)) { @@ -84,24 +84,24 @@ struct MyDocumentDBReferent : public MockDocumentDBReferent { } }; -struct MyReferentRegistry : public IDocumentDBReferentRegistry { - using ReferentMap = std::map<vespalib::string, IDocumentDBReferent::SP>; - ReferentMap map; - virtual IDocumentDBReferent::SP get(vespalib::stringref name) const override { +struct MyReferenceRegistry : public IDocumentDBReferenceRegistry { + using ReferenceMap = std::map<vespalib::string, IDocumentDBReference::SP>; + ReferenceMap map; + virtual IDocumentDBReference::SP get(vespalib::stringref name) const override { auto itr = map.find(name); ASSERT_TRUE(itr != map.end()); return itr->second; } - virtual IDocumentDBReferent::SP tryGet(vespalib::stringref name) const override { + virtual IDocumentDBReference::SP tryGet(vespalib::stringref name) const override { auto itr = map.find(name); if (itr != map.end()) { return itr->second; } else { - return IDocumentDBReferent::SP(); + return IDocumentDBReference::SP(); } } - virtual void add(vespalib::stringref name, IDocumentDBReferent::SP referent) override { - map[name] = referent; + virtual void add(vespalib::stringref name, IDocumentDBReference::SP reference) override { + map[name] = reference; } virtual void remove(vespalib::stringref) override {} }; @@ -182,9 +182,9 @@ struct Fixture { MonitoredRefCount _gidToLidChangeListenerRefCount; std::shared_ptr<MockGidToLidChangeHandler> _parentGidToLidChangeHandler; std::shared_ptr<MockGidToLidChangeHandler> _parentGidToLidChangeHandler2; - MyDocumentDBReferent::SP parentReferent; - MyDocumentDBReferent::SP parentReferent2; - MyReferentRegistry registry; + MyDocumentDBReference::SP parentReference; + MyDocumentDBReference::SP parentReference2; + MyReferenceRegistry registry; MyAttributeManager attrMgr; MyAttributeManager oldAttrMgr; DocumentModel docModel; @@ -195,8 +195,8 @@ struct Fixture { _gidToLidChangeListenerRefCount(), _parentGidToLidChangeHandler(std::make_shared<MockGidToLidChangeHandler>()), _parentGidToLidChangeHandler2(std::make_shared<MockGidToLidChangeHandler>()), - parentReferent(std::make_shared<MyDocumentDBReferent>(factory, _parentGidToLidChangeHandler)), - parentReferent2(std::make_shared<MyDocumentDBReferent>(factory, _parentGidToLidChangeHandler2)), + parentReference(std::make_shared<MyDocumentDBReference>(factory, _parentGidToLidChangeHandler)), + parentReference2(std::make_shared<MyDocumentDBReference>(factory, _parentGidToLidChangeHandler2)), registry(), attrMgr(), docModel(), @@ -204,14 +204,14 @@ struct Fixture { _attributeFieldWriter(1) { - registry.add("parent", parentReferent); - registry.add("parent2", parentReferent2); + registry.add("parent", parentReference); + registry.add("parent2", parentReference2); populateTargetAttributes(); populateAttributeManagers(); } void populateTargetAttributes() { - parentReferent->addIntAttribute("target_a"); - parentReferent->addIntAttribute("target_b"); + parentReference->addIntAttribute("target_a"); + parentReference->addIntAttribute("target_b"); } void populateAttributeManagers() { attrMgr.addReferenceAttribute("ref"); @@ -238,14 +238,14 @@ struct Fixture { ASSERT_TRUE(attr.get()); EXPECT_EQUAL(name, attr->getName()); EXPECT_EQUAL(attrMgr.getReferenceAttribute(referenceField), attr->getReferenceAttribute().get()); - EXPECT_EQUAL(parentReferent->getAttribute(targetField).get(), attr->getTargetAttribute().get()); + EXPECT_EQUAL(parentReference->getAttribute(targetField).get(), attr->getTargetAttribute().get()); } MockGidToLidChangeHandler &getGidToLidChangeHandler(const vespalib::string &referencedDocTypeName) { - auto ireferent = registry.get(referencedDocTypeName); - auto referent = std::dynamic_pointer_cast<MyDocumentDBReferent>(ireferent); - assert(referent); - return referent->getGidToLidChangeHandler(); + auto ireference = registry.get(referencedDocTypeName); + auto reference = std::dynamic_pointer_cast<MyDocumentDBReference>(ireference); + assert(reference); + return reference->getGidToLidChangeHandler(); } void assertParentAdds(const vespalib::string &referencedDocTypeName, const std::vector<AddEntry> &expAdds) diff --git a/searchcore/src/tests/proton/reference/document_db_referent_registry/CMakeLists.txt b/searchcore/src/tests/proton/reference/document_db_referent_registry/CMakeLists.txt deleted file mode 100644 index d30602ce8e5..00000000000 --- a/searchcore/src/tests/proton/reference/document_db_referent_registry/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchcore_document_db_referent_registry_test_app TEST - SOURCES - document_db_referent_registry_test.cpp - DEPENDS - searchcore_reference - searchcore_documentmetastore - searchcore_bucketdb -) -vespa_add_test(NAME searchcore_document_db_referent_registry_test_app COMMAND searchcore_document_db_referent_registry_test_app) diff --git a/searchcore/src/tests/proton/reference/document_db_referent_registry/DESC b/searchcore/src/tests/proton/reference/document_db_referent_registry/DESC deleted file mode 100644 index 03d7d0f167a..00000000000 --- a/searchcore/src/tests/proton/reference/document_db_referent_registry/DESC +++ /dev/null @@ -1 +0,0 @@ -document_db_referent_registry test. Take a look at document_db_referent_registry_test.cpp for details. diff --git a/searchcore/src/tests/proton/reference/document_db_referent_registry/FILES b/searchcore/src/tests/proton/reference/document_db_referent_registry/FILES deleted file mode 100644 index 6ba8e0632f0..00000000000 --- a/searchcore/src/tests/proton/reference/document_db_referent_registry/FILES +++ /dev/null @@ -1 +0,0 @@ -document_db_referent_registry_test.cpp diff --git a/searchcore/src/tests/proton/reference/document_db_referent_registry/document_db_referent_registry_test.cpp b/searchcore/src/tests/proton/reference/document_db_referent_registry/document_db_referent_registry_test.cpp deleted file mode 100644 index 3a23de37a1f..00000000000 --- a/searchcore/src/tests/proton/reference/document_db_referent_registry/document_db_referent_registry_test.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/stllike/string.h> -#include <vespa/searchcore/proton/reference/document_db_referent_registry.h> -#include <vespa/searchcore/proton/test/mock_document_db_referent.h> -#include <thread> -#include <vespa/log/log.h> -LOG_SETUP("document_db_reference_registry_test"); - -namespace proton -{ - -namespace -{ - - -std::mutex lock; -std::shared_ptr<IDocumentDBReferent> getFooResult; - -void getFooTask(const IDocumentDBReferentRegistry *registry) -{ - auto result = registry->get("foo"); - std::lock_guard<std::mutex> guard(lock); - getFooResult = result; -} - -std::shared_ptr<IDocumentDBReferent> checkFooResult() -{ - std::lock_guard<std::mutex> guard(lock); - return getFooResult; -} - -} - -struct Fixture -{ - - DocumentDBReferentRegistry _registry; - - Fixture() - : _registry() - { - } - - test::MockDocumentDBReferent::SP - add(vespalib::string name) { - auto referent = std::make_shared<test::MockDocumentDBReferent>(); - _registry.add(name, referent); - return referent; - } -}; - -TEST_F("Test that we can instantiate registry with two referents", Fixture) -{ - auto referentFoo = f.add("foo"); - auto referentBar = f.add("bar"); - EXPECT_NOT_EQUAL(referentFoo.get(), referentBar.get()); - auto referent = f._registry.get("foo"); - EXPECT_EQUAL(referentFoo.get(), referent.get()); - referent = f._registry.get("bar"); - EXPECT_EQUAL(referentBar.get(), referent.get()); -} - -TEST_F("Test that we block get until related add is completed", Fixture) -{ - const IDocumentDBReferentRegistry ®istry = f._registry; - std::thread getFooThread(getFooTask, ®istry); - sleep(1); - std::shared_ptr<IDocumentDBReferent> nullResult; - EXPECT_EQUAL(nullResult.get(), checkFooResult().get()); - auto referentFoo = f.add("foo"); - std::shared_ptr<IDocumentDBReferent> checkResult; - for (int retry = 0; retry < 60 && !checkResult; ++retry) { - sleep(1); - checkResult = checkFooResult(); - } - EXPECT_EQUAL(referentFoo.get(), checkResult.get()); - getFooThread.join(); -} - -TEST_F("Test that tryGet method can fail", Fixture) -{ - auto referentFoo = f.add("foo"); - auto referent = f._registry.tryGet("foo"); - EXPECT_EQUAL(referentFoo.get(), referent.get()); - referent = f._registry.tryGet("bar"); - EXPECT_TRUE(referent.get() == nullptr); -} - -} - -TEST_MAIN() -{ - TEST_RUN_ALL(); -} diff --git a/searchcore/src/vespa/searchcore/proton/reference/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/reference/CMakeLists.txt index 11f7bc1b81f..e27a1b66249 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/reference/CMakeLists.txt @@ -1,9 +1,9 @@ # Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_library(searchcore_reference STATIC SOURCES + document_db_reference.cpp + document_db_reference_registry.cpp document_db_reference_resolver.cpp - document_db_referent.cpp - document_db_referent_registry.cpp gid_to_lid_change_handler.cpp gid_to_lid_change_listener.cpp gid_to_lid_change_registrator.cpp diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp index 8eddfd8090c..b9306a17bfb 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include "document_db_referent.h" +#include "document_db_reference.h" #include <vespa/searchlib/attribute/attributeguard.h> #include <vespa/searchlib/attribute/iattributemanager.h> #include "gid_to_lid_mapper_factory.h" @@ -10,21 +10,21 @@ namespace proton { -DocumentDBReferent::DocumentDBReferent(std::shared_ptr<search::IAttributeManager> attrMgr, - std::shared_ptr<DocumentMetaStore> dms, - std::shared_ptr<IGidToLidChangeHandler> gidToLidChangeHandler) +DocumentDBReference::DocumentDBReference(std::shared_ptr<search::IAttributeManager> attrMgr, + std::shared_ptr<DocumentMetaStore> dms, + std::shared_ptr<IGidToLidChangeHandler> gidToLidChangeHandler) : _attrMgr(std::move(attrMgr)), _dms(std::move(dms)), _gidToLidChangeHandler(std::move(gidToLidChangeHandler)) { } -DocumentDBReferent::~DocumentDBReferent() +DocumentDBReference::~DocumentDBReference() { } std::shared_ptr<search::AttributeVector> -DocumentDBReferent::getAttribute(vespalib::stringref name) +DocumentDBReference::getAttribute(vespalib::stringref name) { search::AttributeGuard::UP guard = _attrMgr->getAttribute(name); if (guard) { @@ -35,16 +35,15 @@ DocumentDBReferent::getAttribute(vespalib::stringref name) } std::shared_ptr<search::IGidToLidMapperFactory> -DocumentDBReferent::getGidToLidMapperFactory() +DocumentDBReference::getGidToLidMapperFactory() { return std::make_shared<GidToLidMapperFactory>(_dms); } std::unique_ptr<GidToLidChangeRegistrator> -DocumentDBReferent::makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) +DocumentDBReference::makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) { return std::make_unique<GidToLidChangeRegistrator>(_gidToLidChangeHandler, docTypeName); } - } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h index 0adb41a34aa..7ca94279da9 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent.h +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference.h @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "i_document_db_referent.h" +#include "i_document_db_reference.h" namespace search { @@ -20,16 +20,16 @@ class IGidToLidChangeHandler; * attributes, and for getting interface for mapping to lids * compatible with the target attributes. */ -class DocumentDBReferent : public IDocumentDBReferent +class DocumentDBReference : public IDocumentDBReference { std::shared_ptr<search::IAttributeManager> _attrMgr; std::shared_ptr<DocumentMetaStore> _dms; std::shared_ptr<IGidToLidChangeHandler> _gidToLidChangeHandler; public: - DocumentDBReferent(std::shared_ptr<search::IAttributeManager> attrMgr, - std::shared_ptr<DocumentMetaStore> dms, - std::shared_ptr<IGidToLidChangeHandler> gidToLidChangeHandler); - virtual ~DocumentDBReferent(); + DocumentDBReference(std::shared_ptr<search::IAttributeManager> attrMgr, + std::shared_ptr<DocumentMetaStore> dms, + std::shared_ptr<IGidToLidChangeHandler> gidToLidChangeHandler); + virtual ~DocumentDBReference(); virtual std::shared_ptr<search::AttributeVector> getAttribute(vespalib::stringref name) override; virtual std::shared_ptr<search::IGidToLidMapperFactory> getGidToLidMapperFactory() override; virtual std::unique_ptr<GidToLidChangeRegistrator> makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) override; diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent_registry.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp index c9ed5afdad0..80f5d160d8c 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent_registry.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.cpp @@ -1,23 +1,23 @@ // Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include "document_db_referent_registry.h" +#include "document_db_reference_registry.h" namespace proton { -DocumentDBReferentRegistry::DocumentDBReferentRegistry() +DocumentDBReferenceRegistry::DocumentDBReferenceRegistry() : _lock(), _cv(), _handlers() { } -DocumentDBReferentRegistry::~DocumentDBReferentRegistry() +DocumentDBReferenceRegistry::~DocumentDBReferenceRegistry() { } -std::shared_ptr<IDocumentDBReferent> -DocumentDBReferentRegistry::get(vespalib::stringref name) const +std::shared_ptr<IDocumentDBReference> +DocumentDBReferenceRegistry::get(vespalib::stringref name) const { std::unique_lock<std::mutex> guard(_lock); auto itr = _handlers.find(name); @@ -28,20 +28,20 @@ DocumentDBReferentRegistry::get(vespalib::stringref name) const return itr->second; } -std::shared_ptr<IDocumentDBReferent> -DocumentDBReferentRegistry::tryGet(vespalib::stringref name) const +std::shared_ptr<IDocumentDBReference> +DocumentDBReferenceRegistry::tryGet(vespalib::stringref name) const { std::unique_lock<std::mutex> guard(_lock); auto itr = _handlers.find(name); if (itr == _handlers.end()) { - return std::shared_ptr<IDocumentDBReferent>(); + return std::shared_ptr<IDocumentDBReference>(); } else { return itr->second; } } void -DocumentDBReferentRegistry::add(vespalib::stringref name, std::shared_ptr<IDocumentDBReferent> referee) +DocumentDBReferenceRegistry::add(vespalib::stringref name, std::shared_ptr<IDocumentDBReference> referee) { std::lock_guard<std::mutex> guard(_lock); _handlers[name] = referee; @@ -49,7 +49,7 @@ DocumentDBReferentRegistry::add(vespalib::stringref name, std::shared_ptr<IDocum } void -DocumentDBReferentRegistry::remove(vespalib::stringref name) +DocumentDBReferenceRegistry::remove(vespalib::stringref name) { std::lock_guard<std::mutex> guard(_lock); _handlers.erase(name); diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h new file mode 100644 index 00000000000..4a64a6500b2 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_registry.h @@ -0,0 +1,29 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include "i_document_db_reference_registry.h" +#include <mutex> +#include <condition_variable> +#include <map> + +namespace proton { + +/* + * Class implementing a registry of named IDocumentDBReferences. + */ +class DocumentDBReferenceRegistry : public IDocumentDBReferenceRegistry +{ + mutable std::mutex _lock; + mutable std::condition_variable _cv; + std::map<vespalib::string, std::shared_ptr<IDocumentDBReference>> _handlers; +public: + DocumentDBReferenceRegistry(); + virtual ~DocumentDBReferenceRegistry(); + + virtual std::shared_ptr<IDocumentDBReference> get(vespalib::stringref docType) const override; + virtual std::shared_ptr<IDocumentDBReference> tryGet(vespalib::stringref docType) const override; + virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReference> referee) override; + virtual void remove(vespalib::stringref name) override; +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp index 52fe6271041..58cd50fdd46 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.cpp @@ -4,8 +4,8 @@ #include "document_db_reference_resolver.h" #include "gid_to_lid_change_listener.h" #include "gid_to_lid_change_registrator.h" -#include "i_document_db_referent.h" -#include "i_document_db_referent_registry.h" +#include "i_document_db_reference.h" +#include "i_document_db_reference_registry.h" #include <vespa/config-imported-fields.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/document/datatype/referencedatatype.h> @@ -85,7 +85,7 @@ DocumentDBReferenceResolver::getRegistrator(const vespalib::string &docTypeName) return *result; } -IDocumentDBReferent::SP +IDocumentDBReference::SP DocumentDBReferenceResolver::getTargetDocumentDB(const vespalib::string &refAttrName) const { return _registry.get(getTargetDocTypeName(refAttrName, _thisDocType)); @@ -97,7 +97,7 @@ DocumentDBReferenceResolver::connectReferenceAttributesToGidMapper(const IAttrib auto refAttrs(getReferenceAttributes(attrMgr)); for (auto &attrSP : refAttrs) { auto &attr = *attrSP; - IDocumentDBReferent::SP targetDB = getTargetDocumentDB(attr.getName()); + IDocumentDBReference::SP targetDB = getTargetDocumentDB(attr.getName()); attr.setGidToLidMapperFactory(targetDB->getGidToLidMapperFactory()); } } @@ -110,9 +110,9 @@ DocumentDBReferenceResolver::detectOldListeners(const IAttributeManager &attrMgr vespalib::string docTypeName = getTargetDocTypeName(attrSP->getName(), _prevThisDocType); auto ®istratorUP = _registrators[docTypeName]; if (!registratorUP) { - auto referent = _registry.tryGet(docTypeName); - if (referent) { - registratorUP = referent->makeGidToLidChangeRegistrator(_thisDocType.getName()); + auto reference = _registry.tryGet(docTypeName); + if (reference) { + registratorUP = reference->makeGidToLidChangeRegistrator(_thisDocType.getName()); } } } @@ -148,7 +148,7 @@ DocumentDBReferenceResolver::createImportedAttributesRepo(const IAttributeManage return result; } -DocumentDBReferenceResolver::DocumentDBReferenceResolver(const IDocumentDBReferentRegistry ®istry, +DocumentDBReferenceResolver::DocumentDBReferenceResolver(const IDocumentDBReferenceRegistry ®istry, const DocumentType &thisDocType, const ImportedFieldsConfig &importedFieldsCfg, const document::DocumentType &prevThisDocType, diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h index c5af076b624..db354b0b01f 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h +++ b/searchcore/src/vespa/searchcore/proton/reference/document_db_reference_resolver.h @@ -12,8 +12,8 @@ namespace vespa { namespace config { namespace search { namespace internal { cla namespace proton { -class IDocumentDBReferent; -class IDocumentDBReferentRegistry; +class IDocumentDBReference; +class IDocumentDBReferenceRegistry; class ImportedAttributesRepo; class GidToLidChangeRegistrator; class MonitoredRefCount; @@ -25,7 +25,7 @@ class MonitoredRefCount; class DocumentDBReferenceResolver : public IDocumentDBReferenceResolver { private: using ImportedFieldsConfig = const vespa::config::search::internal::InternalImportedFieldsType; - const IDocumentDBReferentRegistry &_registry; + const IDocumentDBReferenceRegistry &_registry; const document::DocumentType &_thisDocType; const ImportedFieldsConfig &_importedFieldsCfg; const document::DocumentType &_prevThisDocType; @@ -34,14 +34,14 @@ private: std::map<vespalib::string, std::unique_ptr<GidToLidChangeRegistrator>> _registrators; GidToLidChangeRegistrator &getRegistrator(const vespalib::string &docTypeName); - std::shared_ptr<IDocumentDBReferent> getTargetDocumentDB(const vespalib::string &refAttrName) const; + std::shared_ptr<IDocumentDBReference> getTargetDocumentDB(const vespalib::string &refAttrName) const; void connectReferenceAttributesToGidMapper(const search::IAttributeManager &attrMgr); std::unique_ptr<ImportedAttributesRepo> createImportedAttributesRepo(const search::IAttributeManager &attrMgr); void detectOldListeners(const search::IAttributeManager &attrMgr); void listenToGidToLidChanges(const search::IAttributeManager &attrMgr); public: - DocumentDBReferenceResolver(const IDocumentDBReferentRegistry ®istry, + DocumentDBReferenceResolver(const IDocumentDBReferenceRegistry ®istry, const document::DocumentType &thisDocType, const ImportedFieldsConfig &importedFieldsCfg, const document::DocumentType &prevThisDocType, diff --git a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent_registry.h b/searchcore/src/vespa/searchcore/proton/reference/document_db_referent_registry.h deleted file mode 100644 index ec045c8026b..00000000000 --- a/searchcore/src/vespa/searchcore/proton/reference/document_db_referent_registry.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "i_document_db_referent_registry.h" -#include <mutex> -#include <condition_variable> -#include <map> - -namespace proton { - -/* - * Class implementing a registry of named IDocumentDBReferents. - */ -class DocumentDBReferentRegistry : public IDocumentDBReferentRegistry -{ - mutable std::mutex _lock; - mutable std::condition_variable _cv; - std::map<vespalib::string, std::shared_ptr<IDocumentDBReferent>> _handlers; -public: - DocumentDBReferentRegistry(); - virtual ~DocumentDBReferentRegistry(); - - virtual std::shared_ptr<IDocumentDBReferent> get(vespalib::stringref docType) const override; - virtual std::shared_ptr<IDocumentDBReferent> tryGet(vespalib::stringref docType) const override; - virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReferent> referee) override; - virtual void remove(vespalib::stringref name) override; -}; - -} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_referent.h b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h index cc0c320ba28..dac6977e23e 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_referent.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference.h @@ -19,11 +19,11 @@ class GidToLidChangeRegistrator; * attributes, and for getting interface for mapping to lids * compatible with the target attributes. */ -class IDocumentDBReferent +class IDocumentDBReference { public: - using SP = std::shared_ptr<IDocumentDBReferent>; - virtual ~IDocumentDBReferent() { } + using SP = std::shared_ptr<IDocumentDBReference>; + virtual ~IDocumentDBReference() { } virtual std::shared_ptr<search::AttributeVector> getAttribute(vespalib::stringref name) = 0; virtual std::shared_ptr<search::IGidToLidMapperFactory> getGidToLidMapperFactory() = 0; virtual std::unique_ptr<GidToLidChangeRegistrator> makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h new file mode 100644 index 00000000000..aec775129fd --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h @@ -0,0 +1,34 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include <vespa/vespalib/stllike/string.h> + +namespace proton { + +class IDocumentDBReference; + +/* + * Interface class for a registry of named IDocumentDBReferences. + */ +class IDocumentDBReferenceRegistry +{ +public: + virtual ~IDocumentDBReferenceRegistry() { } + + /* + * Get named IDocumentDBReference. Block while it doesn't exist. + */ + virtual std::shared_ptr<IDocumentDBReference> get(vespalib::stringref name) const = 0; + + /* + * Get named IDocumentDBReference. Returns empty shared pointer if + * it doesn't exist. + */ + virtual std::shared_ptr<IDocumentDBReference> tryGet(vespalib::stringref name) const = 0; + + virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReference> referee) = 0; + + virtual void remove(vespalib::stringref name) = 0; +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_referent_registry.h b/searchcore/src/vespa/searchcore/proton/reference/i_document_db_referent_registry.h deleted file mode 100644 index 3eff2ab1473..00000000000 --- a/searchcore/src/vespa/searchcore/proton/reference/i_document_db_referent_registry.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include <vespa/vespalib/stllike/string.h> - -namespace proton { - -class IDocumentDBReferent; - -/* - * Interface class for a registry of named IDocumentDBReferents. - */ -class IDocumentDBReferentRegistry -{ -public: - virtual ~IDocumentDBReferentRegistry() { } - - /* - * Get named IDocumentDBReferent. Block while it doesn't exist. - */ - virtual std::shared_ptr<IDocumentDBReferent> get(vespalib::stringref name) const = 0; - - /* - * Get named IDocumentDBReferent. Returns empty shared pointer if - * it doesn't exist. - */ - virtual std::shared_ptr<IDocumentDBReferent> tryGet(vespalib::stringref name) const = 0; - - virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReferent> referee) = 0; - - virtual void remove(vespalib::stringref name) = 0; -}; - -} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 8527211d3bb..d4308f96321 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -18,7 +18,7 @@ #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/initializer/task_runner.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h> -#include <vespa/searchcore/proton/reference/i_document_db_referent_registry.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h> #include <vespa/searchcore/proton/reference/document_db_reference_resolver.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/configconverter.h> @@ -211,14 +211,14 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, } } -void DocumentDB::registerReferent() +void DocumentDB::registerReference() { if (_state.getAllowReconfig()) { - auto registry = _owner.getDocumentDBReferentRegistry(); + auto registry = _owner.getDocumentDBReferenceRegistry(); if (registry) { - auto referent = _subDBs.getReadySubDB()->getDocumentDBReferent(); - if (referent) { - registry->add(_docTypeName.getName(), referent); + auto reference = _subDBs.getReadySubDB()->getDocumentDBReference(); + if (reference) { + registry->add(_docTypeName.getName(), reference); } } } @@ -227,7 +227,7 @@ void DocumentDB::registerReferent() void DocumentDB::setActiveConfig(const DocumentDBConfig::SP &config, SerialNum serialNum, int64_t generation) { lock_guard guard(_configMutex); - registerReferent(); + registerReference(); _activeConfigSnapshot = config; assert(generation >= config->getGeneration()); if (_activeConfigSnapshotGeneration < generation) { @@ -394,7 +394,7 @@ DocumentDB::handleRejectedConfig(DocumentDBConfig::SP &configSnapshot, void DocumentDB::applySubDBConfig(const DocumentDBConfig &newConfigSnapshot, SerialNum serialNum, const ReconfigParams ¶ms) { - auto registry = _owner.getDocumentDBReferentRegistry(); + auto registry = _owner.getDocumentDBReferenceRegistry(); auto oldRepo = _activeConfigSnapshot->getDocumentTypeRepoSP(); auto oldDocType = oldRepo->getDocumentType(_docTypeName.getName()); assert(oldDocType != nullptr); @@ -577,7 +577,7 @@ void DocumentDB::tearDownReferences() { // Called by master executor thread - auto registry = _owner.getDocumentDBReferentRegistry(); + auto registry = _owner.getDocumentDBReferenceRegistry(); auto activeConfig = getActiveConfig(); auto repo = activeConfig->getDocumentTypeRepoSP(); auto docType = repo->getDocumentType(_docTypeName.getName()); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 1f6ad274a0e..9e8b08d5314 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -152,7 +152,7 @@ private: search::CacheStats _lastDocStoreCacheStats; IBucketStateCalculator::SP _calc; - void registerReferent(); + void registerReference(); void setActiveConfig(const DocumentDBConfig::SP &config, SerialNum serialNum, int64_t generation); DocumentDBConfig::SP getActiveConfig() const; void internalInit(); diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h b/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h index 00f4854e9c6..6a9e8702495 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h @@ -8,7 +8,7 @@ namespace proton { -class IDocumentDBReferentRegistry; +class IDocumentDBReferenceRegistry; class IDocumentDBOwner { @@ -20,7 +20,7 @@ public: virtual searchcorespi::IIndexManagerFactory::SP getIndexManagerFactory(const vespalib::stringref & name) const = 0; virtual uint32_t getDistributionKey() const = 0; - virtual std::shared_ptr<IDocumentDBReferentRegistry> getDocumentDBReferentRegistry() const = 0; + virtual std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index 05147aa315f..950a9b0da8f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -32,7 +32,7 @@ class FileConfigManager; class IAttributeManager; class IDcoumentRetriever; class IDocumentDBReferenceResolver; -class IDocumentDBReferent; +class IDocumentDBReference; class IDocumentMetaStoreContext; class IDocumentRetriever; class IFeedView; @@ -129,7 +129,7 @@ public: virtual matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const = 0; virtual void close() = 0; - virtual std::shared_ptr<IDocumentDBReferent> getDocumentDBReferent() = 0; + virtual std::shared_ptr<IDocumentDBReference> getDocumentDBReference() = 0; virtual void tearDownReferences(IDocumentDBReferenceResolver &resolver) = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 7403b219ac3..e494c0e0f1c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -32,8 +32,8 @@ #include <vespa/vespalib/util/random.h> #include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/common/hw_info_sampler.h> -#include <vespa/searchcore/proton/reference/document_db_referent_registry.h> -#include <vespa/searchcore/proton/reference/i_document_db_referent.h> +#include <vespa/searchcore/proton/reference/document_db_reference_registry.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference.h> #include <vespa/document/base/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.proton"); @@ -212,9 +212,9 @@ Proton::Proton(const config::ConfigUri & configUri, _initDocumentDbsInSequence(false), _hwInfo(), _hwInfoSampler(), - _documentDBReferentRegistry() + _documentDBReferenceRegistry() { - _documentDBReferentRegistry = std::make_shared<DocumentDBReferentRegistry>(); + _documentDBReferenceRegistry = std::make_shared<DocumentDBReferenceRegistry>(); } BootstrapConfig::SP @@ -1126,10 +1126,10 @@ Proton::get_child(vespalib::stringref name) const return Explorer_UP(nullptr); } -std::shared_ptr<IDocumentDBReferentRegistry> -Proton::getDocumentDBReferentRegistry() const +std::shared_ptr<IDocumentDBReferenceRegistry> +Proton::getDocumentDBReferenceRegistry() const { - return _documentDBReferentRegistry; + return _documentDBReferenceRegistry; } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index e402de68752..1e4b823dad5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -39,7 +39,7 @@ namespace proton { class DiskMemUsageSampler; class HwInfoSampler; -class IDocumentDBReferentRegistry; +class IDocumentDBReferenceRegistry; class Proton : public IBootstrapOwner, public search::engine::MonitorServer, @@ -147,7 +147,7 @@ private: bool _initDocumentDbsInSequence; HwInfo _hwInfo; std::unique_ptr<HwInfoSampler> _hwInfoSampler; - std::shared_ptr<IDocumentDBReferentRegistry> _documentDBReferentRegistry; + std::shared_ptr<IDocumentDBReferenceRegistry> _documentDBReferenceRegistry; bool performDataDirectoryUpgrade(const vespalib::string &baseDir); void loadLibrary(const vespalib::string &libName); @@ -180,7 +180,7 @@ private: getIndexManagerFactory(const vespalib::stringref & name) const override; uint32_t getDistributionKey() const override { return _distributionKey; } BootstrapConfig::SP getActiveConfigSnapshot() const; - virtual std::shared_ptr<IDocumentDBReferentRegistry> getDocumentDBReferentRegistry() const override; + virtual std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override; public: diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index e543e89c618..30e5beb0a00 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -9,7 +9,7 @@ #include <vespa/searchcore/proton/index/index_manager_initializer.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h> -#include <vespa/searchcore/proton/reference/document_db_referent.h> +#include <vespa/searchcore/proton/reference/document_db_reference.h> #include <vespa/searchcore/proton/reference/gid_to_lid_change_handler.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> #include <vespa/vespalib/io/fileutil.h> @@ -373,10 +373,10 @@ SearchableDocSubDB::close() Parent::close(); } -std::shared_ptr<IDocumentDBReferent> -SearchableDocSubDB::getDocumentDBReferent() +std::shared_ptr<IDocumentDBReference> +SearchableDocSubDB::getDocumentDBReference() { - return std::make_shared<DocumentDBReferent>(getAttributeManager(), _dms, _gidToLidChangeHandler); + return std::make_shared<DocumentDBReference>(getAttributeManager(), _dms, _gidToLidChangeHandler); } void diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index 306a8e53e47..489d9b5a5ce 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -163,7 +163,7 @@ public: IDocumentRetriever::UP getDocumentRetriever() override; matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; virtual void close() override; - virtual std::shared_ptr<IDocumentDBReferent> getDocumentDBReferent() override; + virtual std::shared_ptr<IDocumentDBReference> getDocumentDBReference() override; virtual void tearDownReferences(IDocumentDBReferenceResolver &resolver) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index dc3cf797a7b..586d7cfdf83 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -464,10 +464,10 @@ StoreOnlyDocSubDB::close() store.flush(syncToken); } -std::shared_ptr<IDocumentDBReferent> -StoreOnlyDocSubDB::getDocumentDBReferent() +std::shared_ptr<IDocumentDBReference> +StoreOnlyDocSubDB::getDocumentDBReference() { - return std::shared_ptr<IDocumentDBReferent>(); + return std::shared_ptr<IDocumentDBReference>(); } void diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 1759f29f7d3..3136edcb34f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -285,7 +285,7 @@ public: IDocumentRetriever::UP getDocumentRetriever() override; matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const override; void close() override; - virtual std::shared_ptr<IDocumentDBReferent> getDocumentDBReferent() override; + virtual std::shared_ptr<IDocumentDBReference> getDocumentDBReference() override; virtual void tearDownReferences(IDocumentDBReferenceResolver &resolver) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h index 75bb6e1f6e2..01b64c245d5 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h @@ -93,8 +93,8 @@ struct DummyDocumentSubDb : public IDocumentSubDB matching::MatchingStats getMatcherStats(const vespalib::string &) const override { return matching::MatchingStats(); } - virtual std::shared_ptr<IDocumentDBReferent> getDocumentDBReferent() override { - return std::shared_ptr<IDocumentDBReferent>(); + virtual std::shared_ptr<IDocumentDBReference> getDocumentDBReference() override { + return std::shared_ptr<IDocumentDBReference>(); } virtual void tearDownReferences(IDocumentDBReferenceResolver &) override { } }; diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_document_db_referent.h b/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.h index 255241e0666..2f8162a6151 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_document_db_referent.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_document_db_reference.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/searchcore/proton/reference/i_document_db_referent.h> +#include <vespa/searchcore/proton/reference/i_document_db_reference.h> #include <vespa/searchcore/proton/reference/gid_to_lid_change_registrator.h> namespace search { @@ -13,10 +13,10 @@ namespace proton { namespace test { /** - * Mock of the IDocumentDBReferent interface used for unit testing. + * Mock of the IDocumentDBReference interface used for unit testing. */ -struct MockDocumentDBReferent : public IDocumentDBReferent { - using SP = std::shared_ptr<MockDocumentDBReferent>; +struct MockDocumentDBReference : public IDocumentDBReference { + using SP = std::shared_ptr<MockDocumentDBReference>; virtual std::shared_ptr<search::AttributeVector> getAttribute(vespalib::stringref) override { return std::shared_ptr<search::AttributeVector>(); } |