diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-17 17:09:35 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-17 17:13:34 +0100 |
commit | 4b1fcd494ab08a368c01c566b48707fe9ca42f2f (patch) | |
tree | 3caad86c91fa05b9eadaed8de879fc99ec8d39f8 /searchcore/src | |
parent | ea003d76b62ec90c62146ba8a9d5c1616283e101 (diff) |
Use forward declarations to avoid rebuilding the world when modifying the packet protocol.
Diffstat (limited to 'searchcore/src')
28 files changed, 166 insertions, 154 deletions
diff --git a/searchcore/src/tests/proton/matchengine/matchengine.cpp b/searchcore/src/tests/proton/matchengine/matchengine.cpp index 617c2f81b74..0165e398262 100644 --- a/searchcore/src/tests/proton/matchengine/matchengine.cpp +++ b/searchcore/src/tests/proton/matchengine/matchengine.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("matchengine_test"); - #include <vespa/searchcore/proton/matchengine/matchengine.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/searchlib/engine/docsumreply.h> +#include <vespa/log/log.h> + +LOG_SETUP("matchengine_test"); using namespace proton; using namespace search::engine; diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index 90225b01a41..533bbd9be1d 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("matching_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/document/base/globalid.h> @@ -23,6 +21,9 @@ LOG_SETUP("matching_test"); #include <vespa/searchlib/attribute/extendableattributes.h> #include <vespa/searchlib/common/featureset.h> #include <vespa/searchlib/engine/docsumrequest.h> +#include <vespa/searchlib/engine/searchrequest.h> +#include <vespa/searchlib/engine/docsumreply.h> +#include <vespa/searchlib/engine/searchreply.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/query/tree/querybuilder.h> #include <vespa/searchlib/query/tree/stackdumpcreator.h> @@ -31,6 +32,8 @@ LOG_SETUP("matching_test"); #include <vespa/searchcore/proton/matching/match_params.h> #include <vespa/searchcore/proton/matching/match_tools.h> #include <vespa/searchcore/proton/matching/match_context.h> +#include <vespa/log/log.h> +LOG_SETUP("matching_test"); using namespace proton::matching; using namespace proton; diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index c0692ecd7ec..434589dc47b 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -1,16 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("summaryengine_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcore/proton/summaryengine/summaryengine.h> #include <vespa/searchcore/proton/summaryengine/docsum_by_slime.h> #include <vespa/searchlib/engine/docsumapi.h> +#include <vespa/searchlib/engine/searchreply.h> #include <vespa/searchlib/util/rawbuf.h> #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/data/databuffer.h> #include <vespa/document/util/compressor.h> +#include <vespa/log/log.h> + +LOG_SETUP("summaryengine_test"); using namespace search::engine; using namespace document; diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h b/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h index 14375313906..13fedbef503 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h +++ b/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h @@ -1,12 +1,16 @@ // 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/matching/isearchcontext.h> #include <vespa/searchcore/proton/summaryengine/isearchhandler.h> -#include <vespa/searchlib/engine/searchreply.h> -#include <vespa/searchlib/engine/searchrequest.h> #include <vespa/vespalib/util/thread_bundle.h> +namespace searche { +namespace engine { + class SearchRequest; + class SearchReply; +} +} + namespace proton { /** @@ -16,6 +20,9 @@ namespace proton { */ class IMatchHandler { protected: + using SearchReply = search::engine::SearchReply; + using SearchRequest = search::engine::SearchRequest; + using ThreadBundle = vespalib::ThreadBundle; IMatchHandler() = default; public: IMatchHandler(const IMatchHandler &) = delete; @@ -26,18 +33,13 @@ public: typedef std::unique_ptr<IMatchHandler> UP; typedef std::shared_ptr<IMatchHandler> SP; - /** - * Virtual destructor to allow inheritance. - */ virtual ~IMatchHandler() { } /** * @return Use the request and produce the matching result. */ - virtual search::engine::SearchReply::UP match( - const ISearchHandler::SP &searchHandler, - const search::engine::SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const = 0; + virtual std::unique_ptr<SearchReply> + match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, ThreadBundle &threadBundle) const = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index bdaa534a5be..2c306241e7c 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -1,12 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> #include "matchengine.h" -#include <vespa/log/log.h> -LOG_SETUP(".proton.matchengine.matchengine"); #include <vespa/searchcore/proton/common/state_reporter_utils.h> #include <vespa/vespalib/data/slime/cursor.h> #include <algorithm> +#include <vespa/log/log.h> +LOG_SETUP(".proton.matchengine.matchengine"); + namespace { class SearchTask : public vespalib::Executor::Task { @@ -36,7 +37,6 @@ public: namespace proton { -using namespace matching; using namespace vespalib::slime; MatchEngine::MatchEngine(size_t numThreads, size_t threadsPerSearch, uint32_t distributionKey) diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.h b/searchcore/src/vespa/searchcore/proton/matching/match_master.h index a41efca5a5f..b992863e67e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.h @@ -4,7 +4,6 @@ #include <vespa/vespalib/util/clock.h> #include <vespa/vespalib/util/thread_bundle.h> -#include <vespa/searchlib/engine/searchreply.h> #include <vespa/searchlib/common/featureset.h> #include "result_processor.h" #include "match_params.h" diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 811fb4587c9..94169b662ef 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.matching.matcher"); - #include "isearchcontext.h" #include "match_master.h" #include "match_context.h" @@ -16,11 +13,17 @@ LOG_SETUP(".proton.matching.matcher"); #include "sessionmanager.h" #include <vespa/searchlib/common/resultset.h> #include <vespa/searchlib/engine/errorcodes.h> +#include <vespa/searchlib/engine/docsumrequest.h> +#include <vespa/searchlib/engine/searchrequest.h> +#include <vespa/searchlib/engine/searchreply.h> #include <vespa/searchlib/features/setup.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/test/plugin/setup.h> #include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> + +LOG_SETUP(".proton.matching.matcher"); using search::fef::Properties; using namespace search; diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h index 1b0fd68d08c..569ca857737 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h @@ -10,9 +10,6 @@ #include <vespa/searchcore/proton/matching/querylimiter.h> #include <vespa/searchlib/common/featureset.h> #include <vespa/searchlib/common/resultset.h> -#include <vespa/searchlib/engine/docsumrequest.h> -#include <vespa/searchlib/engine/searchreply.h> -#include <vespa/searchlib/engine/searchrequest.h> #include <vespa/searchlib/queryeval/blueprint.h> #include <vespa/searchlib/fef/fef.h> #include <vespa/searchlib/query/base.h> @@ -23,11 +20,17 @@ namespace search { namespace grouping { -class GroupingContext; -class GroupingSession; + class GroupingContext; + class GroupingSession; } // namespace search::grouping; namespace index { class Schema; } namespace attribute { class IAttributeContext; } +namespace engine { + class Request; + class SearchRequest; + class DocsumRequest; + class SearchReply; +} class IDocumentMetaStore; @@ -62,7 +65,7 @@ private: search::attribute::IAttributeContext & attrCtx, SessionManager &sessionMgr, bool summaryFeatures); - search::engine::SearchReply::UP + std::unique_ptr<search::engine::SearchReply> handleGroupingSession( SessionManager &sessionMgr, search::grouping::GroupingContext & groupingContext, @@ -127,7 +130,7 @@ public: * @param sessionManager multilevel grouping session cache * @param metaStore the document meta store used to map from lid to gid **/ - search::engine::SearchReply::UP + std::unique_ptr<search::engine::SearchReply> match(const search::engine::SearchRequest &request, vespalib::ThreadBundle &threadBundle, ISearchContext &searchContext, diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp index cfe3d8fa74b..1881c824442 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp @@ -7,10 +7,18 @@ LOG_SETUP(".proton.matching.result_processor"); #include <vespa/searchlib/common/sortresults.h> #include <vespa/searchlib/common/docstamp.h> #include <vespa/searchlib/uca/ucaconverter.h> +#include <vespa/searchlib/engine/searchreply.h> namespace proton { namespace matching { +ResultProcessor::Result::Result(std::unique_ptr<search::engine::SearchReply> reply, size_t numFs4Hits) + : _reply(std::move(reply)), + _numFs4Hits(numFs4Hits) +{ } + +ResultProcessor::Result::~Result() { } + ResultProcessor::Sort::Sort(const vespalib::Doom & doom, search::attribute::IAttributeContext &ac, const vespalib::string &ss) : sorter(FastS_DefaultResultSorter::instance()), _ucaFactory(std::make_unique<search::uca::UcaConverterFactory>()), diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h index 4fa581a872d..c829db1f4b8 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.h @@ -12,10 +12,15 @@ #include <vespa/searchlib/common/sortresults.h> #include <vespa/searchlib/common/idocumentmetastore.h> #include <vespa/searchlib/common/resultset.h> -#include <vespa/searchlib/engine/searchreply.h> #include <vespa/vespalib/util/dual_merge_director.h> #include <vespa/vespalib/util/noncopyable.hpp> +namespace search { +namespace engine { + class SearchReply; +} +} + namespace proton { namespace matching { @@ -72,8 +77,9 @@ public: struct Result { typedef std::unique_ptr<Result> UP; - Result(search::engine::SearchReply::UP reply, size_t numFs4Hits) : _reply(std::move(reply)), _numFs4Hits(numFs4Hits) { } - search::engine::SearchReply::UP _reply; + Result(std::unique_ptr<search::engine::SearchReply> reply, size_t numFs4Hits); + ~Result(); + std::unique_ptr<search::engine::SearchReply> _reply; size_t _numFs4Hits; }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h index e257b0ec23e..c7bcd9754d0 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h +++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h @@ -6,6 +6,10 @@ #include <vespa/vespalib/stllike/string.h> #include <memory> +namespace search { +namespace fef { class Properties; } +} + namespace proton { namespace matching { @@ -24,7 +28,7 @@ public: OwnershipBundle & operator = (OwnershipBundle &&) = default; ~OwnershipBundle(); ISearchHandler::SP search_handler; - search::fef::Properties::UP feature_overrides; + std::unique_ptr<search::fef::Properties> feature_overrides; std::unique_ptr<MatchContext> context; }; private: diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 294892d06c1..8abf03ecb94 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -1,11 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.documentdb"); - #include "documentdb.h" - #include "combiningfeedview.h" #include "configvalidator.h" #include "document_meta_store_read_guards.h" @@ -31,6 +27,8 @@ LOG_SETUP(".proton.server.documentdb"); #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/configconverter.h> #include <vespa/searchcommon/common/schemaconfigurer.h> +#include <vespa/searchlib/engine/searchreply.h> +#include <vespa/searchlib/engine/docsumreply.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchlib/common/lambdatask.h> #include <vespa/vespalib/data/fileheader.h> @@ -41,6 +39,9 @@ LOG_SETUP(".proton.server.documentdb"); #include <sstream> #include "documentdbconfigscout.h" #include "commit_and_wait_document_retriever.h" +#include <vespa/log/log.h> + +LOG_SETUP(".proton.server.documentdb"); using vespa::config::search::AttributesConfig; @@ -764,17 +765,15 @@ DocumentDB::getNewestFlushedSerial() return _subDBs.getNewestFlushedSerial(); } -search::engine::SearchReply::UP -DocumentDB::match(const ISearchHandler::SP &, - const search::engine::SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const +std::unique_ptr<SearchReply> +DocumentDB::match(const ISearchHandler::SP &, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const { // Ignore input searchhandler. Use readysubdb's searchhandler instead. ISearchHandler::SP view(_subDBs.getReadySubDB()->getSearchView()); return view->match(view, req, threadBundle); } -DocsumReply::UP +std::unique_ptr<DocsumReply> DocumentDB::getDocsums(const DocsumRequest & request) { ISearchHandler::SP view(_subDBs.getReadySubDB()->getSearchView()); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 2ce28c9153e..efc26510268 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -33,7 +33,6 @@ #include <vespa/searchcore/proton/persistenceengine/bucket_guard.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/searchlib/docstore/cachestats.h> -#include <vespa/searchlib/engine/searchrequest.h> #include <vespa/searchlib/transactionlog/syncproxy.h> #include <vespa/vespalib/util/varholder.h> #include <vespa/searchcore/proton/attribute/attribute_usage_filter.h> @@ -385,12 +384,12 @@ public: virtual SerialNum getNewestFlushedSerial(); - search::engine::SearchReply::UP + std::unique_ptr<search::engine::SearchReply> match(const ISearchHandler::SP &searchHandler, const search::engine::SearchRequest &req, vespalib::ThreadBundle &threadBundle) const; - search::engine::DocsumReply::UP + std::unique_ptr<search::engine::DocsumReply> getDocsums(const search::engine::DocsumRequest & request); IFlushTarget::List getFlushTargets(); diff --git a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp index 6dd2c379a3b..6c975c5ae35 100644 --- a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> +#include "emptysearchview.h" +#include <vespa/searchlib/engine/docsumreply.h> +#include <vespa/searchlib/engine/searchreply.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.emptysearchview"); -#include "emptysearchview.h" - using search::engine::DocsumReply; using search::engine::DocsumRequest; using search::engine::SearchReply; diff --git a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h index c503302db46..68d7a2e9190 100644 --- a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h @@ -16,13 +16,12 @@ public: /** * Implements ISearchHandler */ - virtual search::engine::DocsumReply::UP - getDocsums(const search::engine::DocsumRequest & req); + virtual std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override; - virtual search::engine::SearchReply::UP + virtual std::unique_ptr<SearchReply> match(const ISearchHandler::SP &searchHandler, - const search::engine::SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const; + const SearchRequest &req, + vespalib::ThreadBundle &threadBundle) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp index 5599b245655..f7c1595240e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp @@ -1,9 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> +#include "flushhandlerproxy.h" +#include "documentdb.h" #include <vespa/log/log.h> LOG_SETUP(".proton.server.flushhandlerproxy"); -#include "flushhandlerproxy.h" namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.h index 7e8837c92b0..0e4a34fbe67 100644 --- a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.h +++ b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.h @@ -3,16 +3,17 @@ #pragma once #include <vespa/searchcore/proton/flushengine/iflushhandler.h> -#include "documentdb.h" namespace proton { +class DocumentDB; + class FlushHandlerProxy : public IFlushHandler { private: - DocumentDB::SP _documentDB; + std::shared_ptr<DocumentDB> _documentDB; public: - FlushHandlerProxy(const DocumentDB::SP &documentDB); + FlushHandlerProxy(const std::shared_ptr<DocumentDB> &documentDB); virtual ~FlushHandlerProxy(); diff --git a/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.cpp index 071286c8556..4140cdbc441 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.cpp @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.matchhandlerproxy"); #include "matchhandlerproxy.h" +#include "documentdb.h" +#include <vespa/searchlib/engine/searchreply.h> namespace proton { @@ -20,7 +20,7 @@ MatchHandlerProxy::~MatchHandlerProxy(void) } -search::engine::SearchReply::UP +std::unique_ptr<search::engine::SearchReply> MatchHandlerProxy::match(const ISearchHandler::SP &searchHandler, const search::engine::SearchRequest &req, vespalib::ThreadBundle &threadBundle) const diff --git a/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.h index b9d9017a691..94474cdda5a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.h +++ b/searchcore/src/vespa/searchcore/proton/server/matchhandlerproxy.h @@ -3,27 +3,21 @@ #pragma once #include <vespa/searchcore/proton/matchengine/imatchhandler.h> -#include "documentdb.h" namespace proton { +class DocumentDB; + class MatchHandlerProxy : public IMatchHandler { private: - DocumentDB::SP _documentDB; + std::shared_ptr<DocumentDB> _documentDB; public: - MatchHandlerProxy(const DocumentDB::SP &documentDB); - - virtual - ~MatchHandlerProxy(void); - - /** - * Implements IMatchHandler. - */ - virtual search::engine::SearchReply::UP - match(const ISearchHandler::SP &searchHandler, - const search::engine::SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const; + MatchHandlerProxy(const std::shared_ptr<DocumentDB> &documentDB); + virtual~MatchHandlerProxy(); + + std::unique_ptr<SearchReply> + match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, ThreadBundle &threadBundle) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp index 19577ea4917..466db2a7233 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.matchview"); #include "matchview.h" #include "searchcontext.h" #include <vespa/searchcommon/attribute/iattributecontext.h> @@ -10,6 +8,10 @@ LOG_SETUP(".proton.server.matchview"); #include <vespa/searchcore/proton/matching/search_session.h> #include <vespa/searchlib/queryeval/field_spec.h> #include <vespa/searchlib/queryeval/searchable.h> +#include <vespa/searchlib/engine/searchrequest.h> +#include <vespa/searchlib/engine/searchreply.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.matchview"); using proton::matching::MatchContext; using proton::matching::SearchSession; @@ -23,9 +25,10 @@ using search::queryeval::FieldSpec; using search::queryeval::FieldSpecList; using search::queryeval::Searchable; using searchcorespi::IndexSearchable; +using vespalib::make_string; +using vespalib::ThreadBundle; -namespace proton -{ +namespace proton { using matching::ISearchContext; using matching::Matcher; @@ -43,8 +46,7 @@ MatchView::MatchView(const Matchers::SP &matchers, _sessionMgr(sessionMgr), _metaStore(metaStore), _docIdLimit(docIdLimit) -{ -} +{ } Matcher::SP @@ -52,9 +54,7 @@ MatchView::getMatcher(const vespalib::string & rankProfile) const { Matcher::SP retval = _matchers->lookup(rankProfile); if (retval.get() == NULL) { - throw std::runtime_error(vespalib::make_string( - "Failed locating Matcher for rank profile '%s'", - rankProfile.c_str())); + throw std::runtime_error(make_string("Failed locating Matcher for rank profile '%s'", rankProfile.c_str())); } LOG(debug, "Rankprofile = %s has termwise_limit=%f", rankProfile.c_str(), retval->get_termwise_limit()); return retval; @@ -63,19 +63,14 @@ MatchView::getMatcher(const vespalib::string & rankProfile) const MatchContext::UP MatchView::createContext() const { IAttributeContext::UP attrCtx = _attrMgr->createContext(); - Searchable::SP indexSearchable( - new IndexSearchableToSearchableAdapter( - _indexSearchable, *attrCtx)); - ISearchContext::UP searchCtx(new SearchContext(indexSearchable, - _docIdLimit.get())); - return MatchContext::UP(new MatchContext(std::move(attrCtx), - std::move(searchCtx))); + Searchable::SP indexSearchable(new IndexSearchableToSearchableAdapter(_indexSearchable, *attrCtx)); + ISearchContext::UP searchCtx(new SearchContext(indexSearchable, _docIdLimit.get())); + return MatchContext::UP(new MatchContext(std::move(attrCtx), std::move(searchCtx))); } -SearchReply::UP -MatchView::match(const ISearchHandler::SP &searchHandler, - const SearchRequest &req, +std::unique_ptr<SearchReply> +MatchView::match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const { Matcher::SP matcher = getMatcher(req.ranking); @@ -84,13 +79,8 @@ MatchView::match(const ISearchHandler::SP &searchHandler, owned_objects.search_handler = searchHandler; owned_objects.context = createContext(); MatchContext *ctx = owned_objects.context.get(); - return matcher->match(req, - threadBundle, - ctx->getSearchContext(), - ctx->getAttributeContext(), - *_sessionMgr, - guard->get(), - std::move(owned_objects)); + return matcher->match(req, threadBundle, ctx->getSearchContext(), ctx->getAttributeContext(), + *_sessionMgr, guard->get(), std::move(owned_objects)); } diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.h b/searchcore/src/vespa/searchcore/proton/server/matchview.h index 018290aea14..984695867e6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/matchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/matchview.h @@ -55,7 +55,7 @@ public: matching::MatchContext::UP createContext() const; - search::engine::SearchReply::UP + std::unique_ptr<search::engine::SearchReply> match(const ISearchHandler::SP &searchHandler, const search::engine::SearchRequest &req, vespalib::ThreadBundle &threadBundle) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp index ff811e80f94..094f0f4dd6f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp @@ -1,11 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.persistencehandlerproxy"); -#include "documentretriever.h" #include "persistencehandlerproxy.h" +#include "documentretriever.h" #include <vespa/persistence/spi/result.h> +#include "documentdb.h" +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.persistencehandlerproxy"); using storage::spi::Bucket; using storage::spi::Timestamp; diff --git a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h index 4e1af1ce1d0..26295ab5e67 100644 --- a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h +++ b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h @@ -3,19 +3,22 @@ #pragma once #include <vespa/searchcore/proton/persistenceengine/ipersistencehandler.h> -#include "documentdb.h" namespace proton { +class DocumentDB; +class FeedHandler; +class BucketHandler; +class ClusterStateHandler; class PersistenceHandlerProxy : public IPersistenceHandler { private: - DocumentDB::SP _documentDB; + std::shared_ptr<DocumentDB> _documentDB; FeedHandler &_feedHandler; BucketHandler &_bucketHandler; ClusterStateHandler &_clusterStateHandler; public: - PersistenceHandlerProxy(const DocumentDB::SP &documentDB); + PersistenceHandlerProxy(const std::shared_ptr<DocumentDB> &documentDB); virtual ~PersistenceHandlerProxy(); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp index f996135b5d7..8bb6b29b73a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp @@ -1,9 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> +#include "searchhandlerproxy.h" +#include "documentdb.h" +#include <vespa/searchlib/engine/searchreply.h> +#include <vespa/searchlib/engine/docsumreply.h> + #include <vespa/log/log.h> LOG_SETUP(".proton.server.searchhandlerproxy"); -#include "searchhandlerproxy.h" namespace proton { @@ -13,22 +17,20 @@ SearchHandlerProxy::SearchHandlerProxy(const DocumentDB::SP &documentDB) _documentDB->retain(); } - SearchHandlerProxy::~SearchHandlerProxy(void) { _documentDB->release(); } - -search::engine::DocsumReply::UP -SearchHandlerProxy::getDocsums(const search::engine::DocsumRequest & request) +std::unique_ptr<search::engine::DocsumReply> +SearchHandlerProxy::getDocsums(const DocsumRequest & request) { return _documentDB->getDocsums(request); } -search::engine::SearchReply::UP +std::unique_ptr<search::engine::SearchReply> SearchHandlerProxy::match(const ISearchHandler::SP &searchHandler, - const search::engine::SearchRequest &req, + const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const { return _documentDB->match(searchHandler, req, threadBundle); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h index 1fb25c37f45..c9bfd31c6d8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h @@ -3,33 +3,21 @@ #pragma once #include <vespa/searchcore/proton/summaryengine/isearchhandler.h> -#include "documentdb.h" namespace proton { +class DocumentDB; + class SearchHandlerProxy : public ISearchHandler { private: - DocumentDB::SP _documentDB; + std::shared_ptr<DocumentDB> _documentDB; public: - SearchHandlerProxy(const DocumentDB::SP &documentDB); - - virtual - ~SearchHandlerProxy(void); - - /** - * Implements ISearchHandler. - */ - virtual search::engine::DocsumReply::UP - getDocsums(const search::engine::DocsumRequest & request); - - /** - * @return Use the request and produce the matching result. - */ - virtual search::engine::SearchReply::UP match( - const ISearchHandler::SP &searchHandler, - const search::engine::SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const; + SearchHandlerProxy(const std::shared_ptr<DocumentDB> &documentDB); + + virtual~SearchHandlerProxy(); + std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & request) override; + std::unique_ptr<SearchReply> match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, ThreadBundle &threadBundle) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp index bc8ff807fd7..6ed9b64d13c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp @@ -1,13 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.searchview"); - #include "searchcontext.h" #include "searchview.h" #include <vespa/searchcore/proton/docsummary/docsumcontext.h> #include <vespa/searchcore/proton/matching/match_context.h> +#include <vespa/searchlib/engine/searchreply.h> +#include <vespa/log/log.h> +LOG_SETUP(".proton.server.searchview"); using proton::matching::MatchContext; using search::AttributeGuard; @@ -18,6 +18,7 @@ using search::docsummary::ResultConfig; using search::engine::DocsumReply; using search::engine::DocsumRequest; using search::engine::SearchReply; +using vespalib::ThreadBundle; namespace proton { @@ -161,10 +162,8 @@ SearchView::getDocsumsInternal(const DocsumRequest & req) return reply; } -SearchReply::UP -SearchView::match(const ISearchHandler::SP &self, - const SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const { +std::unique_ptr<SearchReply> +SearchView::match(const ISearchHandler::SP &self, const SearchRequest &req, ThreadBundle &threadBundle) const { return _matchView->match(self, req, threadBundle); } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.h b/searchcore/src/vespa/searchcore/proton/server/searchview.h index b17cd61bc66..aaed3003f33 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.h @@ -12,7 +12,7 @@ class SearchView : public ISearchHandler { public: using IndexSearchable = searchcorespi::IndexSearchable; - using InternalDocsumReply = std::pair<DocsumReply::UP, bool>; + using InternalDocsumReply = std::pair<std::unique_ptr<DocsumReply>, bool>; typedef std::shared_ptr<SearchView> SP; SearchView(const ISummaryManager::ISummarySetup::SP &summarySetup, const MatchView::SP &matchView); @@ -27,8 +27,8 @@ public: DocIdLimit &getDocIdLimit() const { return _matchView->getDocIdLimit(); } matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const { return _matchView->getMatcherStats(rankProfile); } - DocsumReply::UP getDocsums(const DocsumRequest & req) override; - SearchReply::UP match(const ISearchHandler::SP &self, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override; + std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override; + std::unique_ptr<SearchReply> match(const ISearchHandler::SP &self, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override; private: InternalDocsumReply getDocsumsInternal(const DocsumRequest & req); ISummaryManager::ISummarySetup::SP _summarySetup; diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h b/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h index 0383a2b03d2..98bba9dd920 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h @@ -1,12 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchlib/engine/docsumreply.h> -#include <vespa/searchlib/engine/docsumrequest.h> -#include <vespa/searchlib/engine/searchreply.h> -#include <vespa/searchlib/engine/searchrequest.h> #include <vespa/vespalib/util/thread_bundle.h> +namespace search { +namespace engine { + class SearchRequest; + class SearchReply; + class DocsumRequest; + class DocsumReply; +} +} + namespace proton { /** @@ -21,6 +26,7 @@ protected: using SearchReply = search::engine::SearchReply; using SearchRequest = search::engine::SearchRequest; using DocsumRequest = search::engine::DocsumRequest; + using ThreadBundle = vespalib::ThreadBundle; public: typedef std::unique_ptr<ISearchHandler> UP; typedef std::shared_ptr<ISearchHandler> SP; @@ -32,12 +38,10 @@ public: /** * @return Use the request and produce the document summary result. */ - virtual DocsumReply::UP getDocsums(const DocsumRequest & request) = 0; + virtual std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & request) = 0; - virtual SearchReply::UP match( - const ISearchHandler::SP &self, - const SearchRequest &req, - vespalib::ThreadBundle &threadBundle) const = 0; + virtual std::unique_ptr<SearchReply> + match(const ISearchHandler::SP &self, const SearchRequest &req, ThreadBundle &threadBundle) const = 0; }; } // namespace proton |