// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include #include namespace search::fef { class RankingExpressions; class OnnxModels; } namespace searchcorespi { class IndexSearchable; } namespace proton::matching { class QueryLimiter; } namespace vespalib::eval { struct ConstantValueFactory; } namespace vespalib { class Clock; } namespace proton { class AttributeCollectionSpecFactory; class DocumentDBConfig; class DocumentSubDBReconfig; class IAttributeWriter; struct IDocumentDBReferenceResolver; struct IReprocessingInitializer; class MatchView; class Matchers; class ReconfigParams; class SearchView; class SearchableFeedView; /** * Class used to reconfig the feed view and search view used in a searchable sub database. */ class SearchableDocSubDBConfigurer { private: using SearchViewHolder = vespalib::VarHolder>; using FeedViewHolder = vespalib::VarHolder>; const std::shared_ptr& _summaryMgr; SearchViewHolder &_searchView; FeedViewHolder &_feedView; matching::QueryLimiter &_queryLimiter; const vespalib::eval::ConstantValueFactory& _constant_value_factory; const vespalib::Clock &_clock; vespalib::string _subDbName; uint32_t _distributionKey; void reconfigureFeedView(std::shared_ptr attrWriter, std::shared_ptr schema, std::shared_ptr repo); void reconfigureMatchView(const std::shared_ptr& indexSearchable); void reconfigureMatchView(const std::shared_ptr& matchers, const std::shared_ptr& indexSearchable, const std::shared_ptr& attrMgr); void reconfigureSearchView(std::shared_ptr matchView); void reconfigureSearchView(std::shared_ptr summarySetup, std::shared_ptr matchView); public: SearchableDocSubDBConfigurer(const SearchableDocSubDBConfigurer &) = delete; SearchableDocSubDBConfigurer & operator = (const SearchableDocSubDBConfigurer &) = delete; SearchableDocSubDBConfigurer(const std::shared_ptr& summaryMgr, SearchViewHolder &searchView, FeedViewHolder &feedView, matching::QueryLimiter &queryLimiter, const vespalib::eval::ConstantValueFactory& constant_value_factory, const vespalib::Clock &clock, const vespalib::string &subDbName, uint32_t distributionKey); ~SearchableDocSubDBConfigurer(); std::shared_ptr createMatchers(const DocumentDBConfig& new_config_snapshot); void reconfigureIndexSearchable(); std::unique_ptr prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const AttributeCollectionSpecFactory& attr_spec_factory, const ReconfigParams& reconfig_params, uint32_t docid_limit, std::optional serial_num); std::unique_ptr reconfigure(const DocumentDBConfig &newConfig, const DocumentDBConfig &oldConfig, const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver, const DocumentSubDBReconfig& prepared_reconfig, search::SerialNum serial_num); }; } // namespace proton