diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-02-08 17:39:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 17:39:52 +0100 |
commit | 3fe7e34a7a8d953b4142005dfcfbe0d83c791eee (patch) | |
tree | 13a2ff5a578ecce10f5eb70b854b773781860269 | |
parent | af1796736514d76f7ff08adc663471adc9eef6e6 (diff) | |
parent | b13bc1a2b1e556dd0b06501e5475ba6b3b9a9499 (diff) |
Merge pull request #25949 from vespa-engine/toregge/reduce-indirect-include-of-attribute-manager-header-filev8.122.27
Reduce indirect include of attributemanager.h
9 files changed, 62 insertions, 54 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index a987d40fe6d..3f432b69277 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -2,7 +2,7 @@ #pragma once #include "isummarymanager.h" -#include <vespa/searchcore/proton/attribute/attributemanager.h> +#include <vespa/searchcore/proton/attribute/i_attribute_manager.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcorespi/flush/iflushtarget.h> #include <vespa/searchlib/common/tunefileinfo.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index fed94a6ab54..701c84b0dfd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -4,7 +4,6 @@ #include "storeonlydocsubdb.h" #include "fast_access_doc_subdb_configurer.h" #include <vespa/config-attributes.h> -#include <vespa/searchcore/proton/attribute/attributemanager.h> #include <vespa/searchcore/proton/common/docid_limit.h> #include <vespa/searchcore/proton/metrics/attribute_metrics.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> @@ -13,6 +12,8 @@ namespace search::attribute { class Interlock; } namespace proton { +class AttributeManager; + /** * The fast-access sub database keeps fast-access attribute fields in memory * in addition to the underlying document store managed by the parent class. @@ -69,7 +70,7 @@ private: const bool _hasAttributes; const bool _fastAccessAttributesOnly; - AttributeManager::SP _initAttrMgr; + std::shared_ptr<AttributeManager> _initAttrMgr; Configurer::FeedViewVarHolder _fastAccessFeedView; Configurer _configurer; AttributeMetrics &_subAttributeMetrics; @@ -79,9 +80,9 @@ private: SerialNum configSerialNum, std::shared_ptr<initializer::InitializerTask> documentMetaStoreInitTask, DocumentMetaStore::SP documentMetaStore, - std::shared_ptr<AttributeManager::SP> attrMgrResult) const; + std::shared_ptr<std::shared_ptr<AttributeManager>> attrMgrResult) const; - void setupAttributeManager(AttributeManager::SP attrMgrResult); + void setupAttributeManager(std::shared_ptr<AttributeManager> attrMgrResult); void initFeedView(std::shared_ptr<IAttributeWriter> writer, const DocumentDBConfig &configSnapshot); protected: @@ -92,7 +93,7 @@ protected: std::shared_ptr<search::attribute::Interlock> _attribute_interlock; DocIdLimit _docIdLimit; - AttributeManager::SP getAndResetInitAttributeManager(); + std::shared_ptr<AttributeManager> getAndResetInitAttributeManager(); virtual IFlushTargetList getFlushTargetsInternal() override; void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); @@ -118,7 +119,7 @@ public: applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot, SerialNum serialNum, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig) override; - proton::IAttributeManager::SP getAttributeManager() const override; + std::shared_ptr<IAttributeManager> getAttributeManager() const override; IDocumentRetriever::UP getDocumentRetriever() override; void onReplayDone() override; void onReprocessDone(SerialNum serialNum) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp index 52e87ee7283..af1cc170c31 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb_configurer.cpp @@ -5,10 +5,10 @@ #include "document_subdb_reconfig.h" #include "documentdbconfig.h" #include "reconfig_params.h" -#include <vespa/searchcore/proton/attribute/attributemanager.h> +#include <vespa/searchcore/proton/attribute/attribute_collection_spec.h> #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> -#include <vespa/searchcore/proton/attribute/attribute_manager_reconfig.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> +#include <vespa/searchcore/proton/attribute/i_attribute_manager_reconfig.h> #include <vespa/searchcore/proton/common/document_type_inspector.h> #include <vespa/searchcore/proton/common/indexschema_inspector.h> #include <vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp index 532c2e868b6..f865d533d85 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp @@ -2,6 +2,7 @@ #include "matchview.h" #include "searchcontext.h" +#include <vespa/searchcore/proton/attribute/i_attribute_manager.h> #include <vespa/searchcore/proton/matching/matcher.h> #include <vespa/searchlib/engine/searchrequest.h> #include <vespa/searchlib/engine/searchreply.h> @@ -34,8 +35,8 @@ using matching::Matcher; using matching::SessionManager; MatchView::MatchView(Matchers::SP matchers, - IndexSearchable::SP indexSearchable, - IAttributeManager::SP attrMgr, + std::shared_ptr<IndexSearchable> indexSearchable, + std::shared_ptr<IAttributeManager> attrMgr, SessionManager & sessionMgr, IDocumentMetaStoreContext::SP metaStore, DocIdLimit &docIdLimit) diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.h b/searchcore/src/vespa/searchcore/proton/server/matchview.h index 2a4347377df..20db5665832 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.h @@ -3,27 +3,32 @@ #pragma once #include "matchers.h" -#include <vespa/searchcore/proton/attribute/attributemanager.h> #include <vespa/searchcore/proton/common/docid_limit.h> -#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h> #include <vespa/searchcore/proton/matching/match_context.h> #include <vespa/searchcore/proton/summaryengine/isearchhandler.h> -#include <vespa/searchcorespi/index/indexsearchable.h> + +namespace searchcorespi { class IndexSearchable; } namespace proton { namespace matching { - class SessionManager; - class Matcher; + +class MatchContext; +class Matcher; +class SessionManager; + } +struct IAttributeManager; + class MatchView { using SessionManager = matching::SessionManager; - Matchers::SP _matchers; - searchcorespi::IndexSearchable::SP _indexSearchable; - IAttributeManager::SP _attrMgr; + std::shared_ptr<Matchers> _matchers; + std::shared_ptr<searchcorespi::IndexSearchable> _indexSearchable; + std::shared_ptr<IAttributeManager> _attrMgr; SessionManager & _sessionMgr; - IDocumentMetaStoreContext::SP _metaStore; + std::shared_ptr<IDocumentMetaStoreContext> _metaStore; DocIdLimit &_docIdLimit; size_t getNumDocs() const { @@ -35,20 +40,20 @@ public: MatchView(const MatchView &) = delete; MatchView & operator = (const MatchView &) = delete; - MatchView(Matchers::SP matchers, - searchcorespi::IndexSearchable::SP indexSearchable, - IAttributeManager::SP attrMgr, + MatchView(std::shared_ptr<Matchers> matchers, + std::shared_ptr<searchcorespi::IndexSearchable> indexSearchable, + std::shared_ptr<IAttributeManager> attrMgr, SessionManager & sessionMgr, - IDocumentMetaStoreContext::SP metaStore, + std::shared_ptr<IDocumentMetaStoreContext> metaStore, DocIdLimit &docIdLimit); ~MatchView(); - const Matchers::SP & getMatchers() const { return _matchers; } - const searchcorespi::IndexSearchable::SP & getIndexSearchable() const { return _indexSearchable; } - const IAttributeManager::SP & getAttributeManager() const { return _attrMgr; } - SessionManager & getSessionManager() const { return _sessionMgr; } - const IDocumentMetaStoreContext::SP & getDocumentMetaStore() const { return _metaStore; } - DocIdLimit & getDocIdLimit() const { return _docIdLimit; } + const std::shared_ptr<Matchers>& getMatchers() const noexcept { return _matchers; } + const std::shared_ptr<searchcorespi::IndexSearchable>& getIndexSearchable() const noexcept { return _indexSearchable; } + const std::shared_ptr<IAttributeManager>& getAttributeManager() const noexcept { return _attrMgr; } + SessionManager & getSessionManager() const noexcept { return _sessionMgr; } + const std::shared_ptr<IDocumentMetaStoreContext>& getDocumentMetaStore() const noexcept { return _metaStore; } + DocIdLimit & getDocIdLimit() const noexcept { return _docIdLimit; } // Throws on error. std::shared_ptr<matching::Matcher> getMatcher(const vespalib::string & rankProfile) const; @@ -58,7 +63,7 @@ public: return _matchers->getStats(rankProfile); } - matching::MatchContext::UP createContext() const; + std::unique_ptr<matching::MatchContext> createContext() const; std::unique_ptr<search::engine::SearchReply> match(std::shared_ptr<const ISearchHandler> searchHandler, diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp index f6a9d640f9b..3ffd610221b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp @@ -7,9 +7,10 @@ #include "searchview.h" #include <vespa/config-rank-profiles.h> #include <vespa/searchcore/proton/matching/matcher.h> +#include <vespa/searchcore/proton/attribute/attribute_collection_spec.h> #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> -#include <vespa/searchcore/proton/attribute/attribute_manager_reconfig.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> +#include <vespa/searchcore/proton/attribute/i_attribute_manager_reconfig.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/document_type_inspector.h> #include <vespa/searchcore/proton/common/indexschema_inspector.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index 0f3c1f19ddb..45a9f1a27b1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -11,7 +11,6 @@ #include <vespa/config-rank-profiles.h> #include <vespa/eval/eval/value_cache/constant_tensor_loader.h> #include <vespa/eval/eval/value_cache/constant_value_cache.h> -#include <vespa/searchcore/proton/attribute/attributemanager.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/docsummary/summarymanager.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> @@ -110,11 +109,11 @@ public: void clearViews() override; - proton::IAttributeManager::SP getAttributeManager() const override { + std::shared_ptr<IAttributeManager> getAttributeManager() const override { return _rSearchView.get()->getAttributeManager(); } - const searchcorespi::IIndexManager::SP &getIndexManager() const override { + const std::shared_ptr<searchcorespi::IIndexManager>& getIndexManager() const override { return _indexMgr; } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp index 7a909bbebd8..0c96b43a727 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp @@ -3,6 +3,7 @@ #include "searchview.h" #include <vespa/searchcore/proton/docsummary/docsumcontext.h> #include <vespa/searchlib/engine/searchreply.h> +#include <vespa/searchlib/queryeval/begin_and_end_id.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/util/issue.h> @@ -77,7 +78,7 @@ hasAnyLidsMoved(const DocsumRequest & request, /** * Create empty docsum reply **/ -DocsumReply::UP +std::unique_ptr<DocsumReply> createEmptyReply(const DocsumRequest &) { return std::make_unique<DocsumReply>(); @@ -86,10 +87,10 @@ createEmptyReply(const DocsumRequest &) } std::shared_ptr<SearchView> -SearchView::create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView) { +SearchView::create(std::shared_ptr<ISummaryManager::ISummarySetup> summarySetup, std::shared_ptr<MatchView> matchView) { return std::shared_ptr<SearchView>( new SearchView(std::move(summarySetup), std::move(matchView))); } -SearchView::SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView) +SearchView::SearchView(std::shared_ptr<ISummaryManager::ISummarySetup> summarySetup, std::shared_ptr<MatchView> matchView) : ISearchHandler(), _summarySetup(std::move(summarySetup)), _matchView(std::move(matchView)) @@ -97,7 +98,7 @@ SearchView::SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchVie SearchView::~SearchView() = default; -DocsumReply::UP +std::unique_ptr<DocsumReply> SearchView::getDocsums(const DocsumRequest & req) { LOG(spam, "getDocsums(): resultClass(%s), numHits(%zu)", req.resultClassName.c_str(), req.hits.size()); @@ -117,14 +118,14 @@ SearchView::getDocsums(const DocsumRequest & req) SearchView::InternalDocsumReply SearchView::getDocsumsInternal(const DocsumRequest & req) { - IDocumentMetaStoreContext::IReadGuard::UP readGuard = _matchView->getDocumentMetaStore()->getReadGuard(); + auto readGuard = _matchView->getDocumentMetaStore()->getReadGuard(); const search::IDocumentMetaStore & metaStore = readGuard->get(); uint32_t numUsedLids = metaStore.getNumUsedLids(); uint64_t startGeneration = readGuard->get().getCurrentGeneration(); convertGidsToLids(req, metaStore, _matchView->getDocIdLimit().get()); - IDocsumStore::UP store(_summarySetup->createDocsumStore()); - MatchContext::UP mctx = _matchView->createContext(); + auto store(_summarySetup->createDocsumStore()); + auto mctx = _matchView->createContext(); auto ctx = std::make_unique<DocsumContext>(req, _summarySetup->getDocsumWriter(), *store, _matchView->getMatcher(req.ranking), mctx->getSearchContext(), mctx->getAttributeContext(), *_summarySetup->getAttributeManager(), getSessionManager()); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.h b/searchcore/src/vespa/searchcore/proton/server/searchview.h index f27052cace1..f2c88963c83 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.h @@ -16,30 +16,30 @@ public: using InternalDocsumReply = std::pair<std::unique_ptr<DocsumReply>, bool>; using SP = std::shared_ptr<SearchView>; - static std::shared_ptr<SearchView> create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView); + static std::shared_ptr<SearchView> create(std::shared_ptr<ISummaryManager::ISummarySetup> summarySetup, std::shared_ptr<MatchView> matchView); SearchView(const SearchView &) = delete; SearchView(SearchView &&) = delete; SearchView &operator=(const SearchView &) = delete; SearchView &operator=(SearchView &&) = delete; ~SearchView() override; - const ISummaryManager::ISummarySetup::SP & getSummarySetup() const { return _summarySetup; } - const MatchView::SP & getMatchView() const { return _matchView; } - const Matchers::SP & getMatchers() const { return _matchView->getMatchers(); } - const IndexSearchable::SP & getIndexSearchable() const { return _matchView->getIndexSearchable(); } - const IAttributeManager::SP & getAttributeManager() const { return _matchView->getAttributeManager(); } - SessionManager & getSessionManager() const { return _matchView->getSessionManager(); } - const IDocumentMetaStoreContext::SP & getDocumentMetaStore() const { return _matchView->getDocumentMetaStore(); } - DocIdLimit &getDocIdLimit() const { return _matchView->getDocIdLimit(); } + const std::shared_ptr<ISummaryManager::ISummarySetup>& getSummarySetup() const noexcept { return _summarySetup; } + const std::shared_ptr<MatchView>& getMatchView() const noexcept { return _matchView; } + const std::shared_ptr<Matchers>& getMatchers() const noexcept { return _matchView->getMatchers(); } + const std::shared_ptr<IndexSearchable>& getIndexSearchable() const noexcept { return _matchView->getIndexSearchable(); } + const std::shared_ptr<IAttributeManager>& getAttributeManager() const noexcept { return _matchView->getAttributeManager(); } + SessionManager & getSessionManager() const noexcept { return _matchView->getSessionManager(); } + const std::shared_ptr<IDocumentMetaStoreContext>& getDocumentMetaStore() const noexcept { return _matchView->getDocumentMetaStore(); } + DocIdLimit &getDocIdLimit() const noexcept { return _matchView->getDocIdLimit(); } matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const { return _matchView->getMatcherStats(rankProfile); } std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override; std::unique_ptr<SearchReply> match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override; private: - SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView); + SearchView(std::shared_ptr<ISummaryManager::ISummarySetup> summarySetup, std::shared_ptr<MatchView> matchView); InternalDocsumReply getDocsumsInternal(const DocsumRequest & req); - ISummaryManager::ISummarySetup::SP _summarySetup; - MatchView::SP _matchView; + std::shared_ptr<ISummaryManager::ISummarySetup> _summarySetup; + std::shared_ptr<MatchView> _matchView; }; } // namespace proton |