diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 14:05:50 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 14:11:05 +0000 |
commit | 91a0164390282d89b5b295142e4f06ce27afdbc2 (patch) | |
tree | 5645cc655627e2c1d44170cbc8c20e5c30af320a | |
parent | 02227976fd12c40beb2fcfd2361c52e02b9f06ab (diff) |
Start using DocumentTypeRepoFactory.
3 files changed, 11 insertions, 4 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp index 9f0d694aa57..0c2870ad35d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp @@ -2,6 +2,7 @@ #include "bootstrapconfigmanager.h" #include "bootstrapconfig.h" +#include <vespa/document/repo/document_type_repo_factory.h> #include <vespa/searchcore/proton/common/hw_info_sampler.h> #include <vespa/config-bucketspaces.h> #include <vespa/searchlib/common/tunefileinfo.hpp> @@ -19,6 +20,7 @@ using vespa::config::search::core::ProtonConfig; using cloud::config::filedistribution::FiledistributorrpcConfig; using vespa::config::content::core::BucketspacesConfig; using document::DocumenttypesConfig; +using document::DocumentTypeRepoFactory; using BucketspacesConfigSP = std::shared_ptr<BucketspacesConfig>; namespace proton { @@ -99,7 +101,7 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot) if (snapshot.isChanged<DocumenttypesConfig>(_configId, currentGen)) { LOG(spam, "Documenttypes config is changed"); newDocumenttypesConfig = snapshot.getConfig<DocumenttypesConfig>(_configId); - newRepo = std::make_shared<DocumentTypeRepo>(*newDocumenttypesConfig); + newRepo = DocumentTypeRepoFactory::make(*newDocumenttypesConfig); } if (snapshot.isChanged<BucketspacesConfig>(_configId, currentGen)) { LOG(spam, "Bucketspaces config is changed"); diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index e017d9b81d4..76f2ffce93a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -7,6 +7,7 @@ #include <vespa/config/print/fileconfigsnapshotreader.h> #include <vespa/config/print/fileconfigsnapshotwriter.h> #include <vespa/config-bucketspaces.h> +#include <vespa/document/repo/document_type_repo_factory.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/config-summarymap.h> @@ -20,6 +21,7 @@ LOG_SETUP(".proton.server.fileconfigmanager"); using document::DocumentTypeRepo; +using document::DocumentTypeRepoFactory; using document::DocumenttypesConfig; using search::IndexMetaInfo; using search::SerialNum; @@ -347,7 +349,7 @@ FileConfigManager::loadConfig(const DocumentDBConfig ¤tSnapshot, docTypesCfg = currentSnapshot.getDocumenttypesConfigSP(); repo = currentSnapshot.getDocumentTypeRepoSP(); } else { - repo.reset(new DocumentTypeRepo(*docTypesCfg)); + repo = DocumentTypeRepoFactory::make(*docTypesCfg); } auto filedistRpcConf = std::make_shared<FiledistributorrpcConfig>(); diff --git a/storageserver/src/vespa/storageserver/app/process.cpp b/storageserver/src/vespa/storageserver/app/process.cpp index a604490ba85..0ebce27eebb 100644 --- a/storageserver/src/vespa/storageserver/app/process.cpp +++ b/storageserver/src/vespa/storageserver/app/process.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "process.h" +#include <vespa/document/repo/document_type_repo_factory.h> #include <vespa/storage/storageserver/storagenode.h> #include <vespa/storage/storageserver/storagenodecontext.h> #include <vespa/vespalib/util/exceptions.h> @@ -8,6 +9,8 @@ #include <vespa/log/log.h> LOG_SETUP(".process"); +using document::DocumentTypeRepoFactory; + namespace storage { Process::Process(const config::ConfigUri & configUri) @@ -22,7 +25,7 @@ Process::setupConfig(uint64_t subscribeTimeout) if (!_configSubscriber.nextConfig()) { throw vespalib::TimeoutException("Could not subscribe to document config within timeout"); } - _repos.push_back(std::make_shared<document::DocumentTypeRepo>(*_documentHandler->getConfig())); + _repos.push_back(DocumentTypeRepoFactory::make(*_documentHandler->getConfig())); getContext().getComponentRegister().setDocumentTypeRepo(_repos.back()); } @@ -41,7 +44,7 @@ void Process::updateConfig() { if (_documentHandler->isChanged()) { - _repos.push_back(std::make_shared<document::DocumentTypeRepo>(*_documentHandler->getConfig())); + _repos.push_back(DocumentTypeRepoFactory::make(*_documentHandler->getConfig())); getNode().setNewDocumentRepo(_repos.back()); } } |