From b13bc1a2b1e556dd0b06501e5475ba6b3b9a9499 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Wed, 8 Feb 2023 16:57:35 +0100 Subject: Reduce indirect include of attributemanager.h --- .../searchcore/proton/docsummary/summarymanager.h | 2 +- .../proton/server/fast_access_doc_subdb.h | 13 ++++--- .../server/fast_access_doc_subdb_configurer.cpp | 4 +- .../vespa/searchcore/proton/server/matchview.cpp | 5 ++- .../src/vespa/searchcore/proton/server/matchview.h | 45 ++++++++++++---------- .../server/searchable_doc_subdb_configurer.cpp | 3 +- .../searchcore/proton/server/searchabledocsubdb.h | 5 +-- .../vespa/searchcore/proton/server/searchview.cpp | 15 ++++---- .../vespa/searchcore/proton/server/searchview.h | 24 ++++++------ 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 +#include #include #include #include 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 -#include #include #include #include @@ -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 _initAttrMgr; Configurer::FeedViewVarHolder _fastAccessFeedView; Configurer _configurer; AttributeMetrics &_subAttributeMetrics; @@ -79,9 +80,9 @@ private: SerialNum configSerialNum, std::shared_ptr documentMetaStoreInitTask, DocumentMetaStore::SP documentMetaStore, - std::shared_ptr attrMgrResult) const; + std::shared_ptr> attrMgrResult) const; - void setupAttributeManager(AttributeManager::SP attrMgrResult); + void setupAttributeManager(std::shared_ptr attrMgrResult); void initFeedView(std::shared_ptr writer, const DocumentDBConfig &configSnapshot); protected: @@ -92,7 +93,7 @@ protected: std::shared_ptr _attribute_interlock; DocIdLimit _docIdLimit; - AttributeManager::SP getAndResetInitAttributeManager(); + std::shared_ptr 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 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 +#include #include -#include #include +#include #include #include #include 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 #include #include #include @@ -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, + std::shared_ptr 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 #include -#include +#include #include #include -#include + +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; + std::shared_ptr _indexSearchable; + std::shared_ptr _attrMgr; SessionManager & _sessionMgr; - IDocumentMetaStoreContext::SP _metaStore; + std::shared_ptr _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, + std::shared_ptr indexSearchable, + std::shared_ptr attrMgr, SessionManager & sessionMgr, - IDocumentMetaStoreContext::SP metaStore, + std::shared_ptr 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& getMatchers() const noexcept { return _matchers; } + const std::shared_ptr& getIndexSearchable() const noexcept { return _indexSearchable; } + const std::shared_ptr& getAttributeManager() const noexcept { return _attrMgr; } + SessionManager & getSessionManager() const noexcept { return _sessionMgr; } + const std::shared_ptr& getDocumentMetaStore() const noexcept { return _metaStore; } + DocIdLimit & getDocIdLimit() const noexcept { return _docIdLimit; } // Throws on error. std::shared_ptr getMatcher(const vespalib::string & rankProfile) const; @@ -58,7 +63,7 @@ public: return _matchers->getStats(rankProfile); } - matching::MatchContext::UP createContext() const; + std::unique_ptr createContext() const; std::unique_ptr match(std::shared_ptr 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 #include +#include #include -#include #include +#include #include #include #include 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 #include #include -#include #include #include #include @@ -110,11 +109,11 @@ public: void clearViews() override; - proton::IAttributeManager::SP getAttributeManager() const override { + std::shared_ptr getAttributeManager() const override { return _rSearchView.get()->getAttributeManager(); } - const searchcorespi::IIndexManager::SP &getIndexManager() const override { + const std::shared_ptr& 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 #include +#include #include #include @@ -77,7 +78,7 @@ hasAnyLidsMoved(const DocsumRequest & request, /** * Create empty docsum reply **/ -DocsumReply::UP +std::unique_ptr createEmptyReply(const DocsumRequest &) { return std::make_unique(); @@ -86,10 +87,10 @@ createEmptyReply(const DocsumRequest &) } std::shared_ptr -SearchView::create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView) { +SearchView::create(std::shared_ptr summarySetup, std::shared_ptr matchView) { return std::shared_ptr( new SearchView(std::move(summarySetup), std::move(matchView))); } -SearchView::SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView) +SearchView::SearchView(std::shared_ptr summarySetup, std::shared_ptr 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 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(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, bool>; using SP = std::shared_ptr; - static std::shared_ptr create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView); + static std::shared_ptr create(std::shared_ptr summarySetup, std::shared_ptr 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& getSummarySetup() const noexcept { return _summarySetup; } + const std::shared_ptr& getMatchView() const noexcept { return _matchView; } + const std::shared_ptr& getMatchers() const noexcept { return _matchView->getMatchers(); } + const std::shared_ptr& getIndexSearchable() const noexcept { return _matchView->getIndexSearchable(); } + const std::shared_ptr& getAttributeManager() const noexcept { return _matchView->getAttributeManager(); } + SessionManager & getSessionManager() const noexcept { return _matchView->getSessionManager(); } + const std::shared_ptr& 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 getDocsums(const DocsumRequest & req) override; std::unique_ptr match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override; private: - SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView); + SearchView(std::shared_ptr summarySetup, std::shared_ptr matchView); InternalDocsumReply getDocsumsInternal(const DocsumRequest & req); - ISummaryManager::ISummarySetup::SP _summarySetup; - MatchView::SP _matchView; + std::shared_ptr _summarySetup; + std::shared_ptr _matchView; }; } // namespace proton -- cgit v1.2.3