diff options
23 files changed, 28 insertions, 31 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h b/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h index 3ef9d2abf1a..fc657d606f9 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h +++ b/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h @@ -23,7 +23,7 @@ public: class IAttributeExecutor { public: virtual ~IAttributeExecutor() { } - virtual void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const = 0; + virtual void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const = 0; }; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index 394e5f4fff4..176c9e67608 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -456,7 +456,7 @@ public: _ctx.releaseEnumGuards(); _importedCtx.releaseEnumGuards(); } - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override { + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override { _ctx.asyncForAttribute(name, std::move(func)); } }; @@ -586,7 +586,7 @@ AttributeManager::asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> func) } void -AttributeManager::asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const { +AttributeManager::asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const { AttributeMap::const_iterator itr = _attributes.find(name); if (itr == _attributes.end() || itr->second.isExtra() || !func) { return; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h index 78760d466e8..9690fdcbdfe 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h @@ -171,7 +171,7 @@ public: const std::vector<search::AttributeVector *> &getWritableAttributes() const override; void asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> func) const override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; ExclusiveAttributeReadAccessor::UP getExclusiveReadAccessor(const vespalib::string &name) const override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp index 8100333397c..47a11b1c98d 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp @@ -201,7 +201,7 @@ FilterAttributeManager::asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> } void -FilterAttributeManager::asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const { +FilterAttributeManager::asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const { AttributeGuard::UP attr = _mgr->getAttribute(name); if (!attr) { return; } search::ISequencedTaskExecutor &attributeFieldWriter = getAttributeFieldWriter(); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h index 918432ddcd7..12e88157075 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h @@ -55,7 +55,7 @@ public: void setImportedAttributes(std::unique_ptr<ImportedAttributesRepo> attributes) override; const ImportedAttributesRepo *getImportedAttributes() const override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp index 92b4d70893d..3890b5f12e3 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp @@ -72,7 +72,7 @@ ImportedAttributesContext::releaseEnumGuards() } void -ImportedAttributesContext::asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor> ) const { +ImportedAttributesContext::asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor> ) const { throw std::runtime_error("proton::ImportedAttributesContext::asyncForAttribute should never be called."); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h index 0c81a5c4688..a82096f0e30 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h @@ -52,7 +52,7 @@ public: void getAttributeList(std::vector<const IAttributeVector *> &list) const override; void releaseEnumGuards() override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp index c275337cc7e..07c672a3fe1 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp @@ -23,7 +23,7 @@ RequestContext::getAttributeStableEnum(const vespalib::string &name) const return _attributeContext.getAttributeStableEnum(name); } -void RequestContext::asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const { +void RequestContext::asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const { _attributeContext.asyncForAttribute(name, std::move(func)); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h index 91e1e906e87..19e6331d14d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h +++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h @@ -18,7 +18,7 @@ public: const Doom & getSoftDoom() const override { return _softDoom; } const search::attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; const search::attribute::IAttributeVector *getAttributeStableEnum(const vespalib::string &name) const override; private: diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h index 874ea0c460d..e37fed4a9c6 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h @@ -75,7 +75,7 @@ public: const ImportedAttributesRepo *getImportedAttributes() const override { return _importedAttributes.get(); } - void asyncForAttribute(const vespalib::string & name, std::shared_ptr<IAttributeFunctor> func) const override { + void asyncForAttribute(const vespalib::string & name, std::unique_ptr<IAttributeFunctor> func) const override { _mock.asyncForAttribute(name, std::move(func)); } }; diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index f5f00993f7d..ebd8a1014b2 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -122,7 +122,7 @@ public: return IAttributeContext::UP(); } - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; }; struct Result { @@ -180,7 +180,7 @@ MyAttributeManager::MyAttributeManager(AttributeVector::SP attr) MyAttributeManager::~MyAttributeManager() = default; void -MyAttributeManager::asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const { +MyAttributeManager::asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const { } diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 7161442df8b..d0a04e2a007 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -78,7 +78,7 @@ public: return IAttributeContext::UP(); } - void asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const override { + void asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override { assert(!"Not implemented"); } }; diff --git a/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp b/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp index a39ff2c6378..60916c7251d 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributecontext.cpp @@ -69,7 +69,7 @@ AttributeContext::getAttributeList(std::vector<const IAttributeVector *> & list) } void -AttributeContext::asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const { +AttributeContext::asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const { _manager.asyncForAttribute(name, std::move(func)); } diff --git a/searchlib/src/vespa/searchlib/attribute/attributecontext.h b/searchlib/src/vespa/searchlib/attribute/attributecontext.h index 0313ef12995..146b56eed03 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributecontext.h +++ b/searchlib/src/vespa/searchlib/attribute/attributecontext.h @@ -29,11 +29,11 @@ private: public: AttributeContext(const IAttributeManager & manager); - ~AttributeContext(); + ~AttributeContext() override; // Implements IAttributeContext const attribute::IAttributeVector * getAttribute(const string & name) const override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override; const attribute::IAttributeVector * getAttributeStableEnum(const string & name) const override; void getAttributeList(std::vector<const IAttributeVector *> & list) const override; void releaseEnumGuards() override; diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp index a28ed98c169..7295cd78df6 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp @@ -203,7 +203,7 @@ AttributeManager::getAttributeList(AttributeList & list) const IAttributeContext::UP AttributeManager::createContext() const { - return IAttributeContext::UP(new AttributeContext(*this)); + return std::make_unique<AttributeContext>(*this); } string @@ -260,7 +260,7 @@ AttributeManager::addVector(const string & name, const Config & config) } void -AttributeManager::asyncForAttribute(const vespalib::string &, std::shared_ptr<attribute::IAttributeFunctor>) const { +AttributeManager::asyncForAttribute(const vespalib::string &, std::unique_ptr<attribute::IAttributeFunctor>) const { throw std::runtime_error("search::AttributeManager::asyncForAttribute should never be called."); } diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.h b/searchlib/src/vespa/searchlib/attribute/attributemanager.h index 6171865c2db..1c60ab00585 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.h +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.h @@ -38,7 +38,7 @@ public: AttributeGuard::UP getAttribute(const string & name) const override; std::unique_ptr<attribute::AttributeReadGuard> getAttributeReadGuard(const string &name, bool stableEnumGuard) const override; - void asyncForAttribute(const vespalib::string &name, std::shared_ptr<attribute::IAttributeFunctor> func) const override; + void asyncForAttribute(const vespalib::string &name, std::unique_ptr<attribute::IAttributeFunctor> func) const override; /** * This will load attributes in the most memory economical way by loading largest first. @@ -55,7 +55,6 @@ public: bool hasReaders() const; uint64_t getMemoryFootprint() const; - protected: typedef vespalib::hash_map<string, VectorHolder> AttributeMap; AttributeMap _attributes; @@ -69,4 +68,3 @@ private: }; } - diff --git a/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.cpp b/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.cpp index c7ee8501e7e..786140273c5 100644 --- a/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.cpp @@ -20,7 +20,7 @@ MockAttributeContext::getAttributeList(std::vector<const IAttributeVector *> & l } void -MockAttributeContext::asyncForAttribute(const vespalib::string &, std::shared_ptr<attribute::IAttributeFunctor>) const { +MockAttributeContext::asyncForAttribute(const vespalib::string &, std::unique_ptr<attribute::IAttributeFunctor>) const { } } diff --git a/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.h b/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.h index b1b58086caa..956c8e453c8 100644 --- a/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.h +++ b/searchlib/src/vespa/searchlib/fef/test/mock_attribute_context.h @@ -33,7 +33,7 @@ public: void getAttributeList(std::vector<const IAttributeVector *> & list) const override; void - asyncForAttribute(const vespalib::string &name, std::shared_ptr<attribute::IAttributeFunctor> func) const override; + asyncForAttribute(const vespalib::string &name, std::unique_ptr<attribute::IAttributeFunctor> func) const override; }; } diff --git a/searchlib/src/vespa/searchlib/test/mock_attribute_context.cpp b/searchlib/src/vespa/searchlib/test/mock_attribute_context.cpp index 03a11efbcbd..e54613716ad 100644 --- a/searchlib/src/vespa/searchlib/test/mock_attribute_context.cpp +++ b/searchlib/src/vespa/searchlib/test/mock_attribute_context.cpp @@ -41,7 +41,7 @@ MockAttributeContext::add(IAttributeVector *attr) { } void -MockAttributeContext::asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const { +MockAttributeContext::asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const { throw std::runtime_error("MockAttributeContext::asyncForAttribute is not implemented and should not be reached"); } diff --git a/searchlib/src/vespa/searchlib/test/mock_attribute_context.h b/searchlib/src/vespa/searchlib/test/mock_attribute_context.h index d12dbe34b6f..4b1b60738d5 100644 --- a/searchlib/src/vespa/searchlib/test/mock_attribute_context.h +++ b/searchlib/src/vespa/searchlib/test/mock_attribute_context.h @@ -21,8 +21,7 @@ public: const IAttributeVector * getAttribute(const string &name) const override; const IAttributeVector * getAttributeStableEnum(const string &name) const override; void getAttributeList(std::vector<const IAttributeVector *> & list) const override; - void asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const override; - + void asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override; }; } diff --git a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp index 88a3bcc78cf..5ef9b6cb2d4 100644 --- a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp +++ b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.cpp @@ -24,7 +24,7 @@ MockAttributeManager::getAttribute(const vespalib::string &name) const { } void -MockAttributeManager::asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const { +MockAttributeManager::asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const { throw std::runtime_error("search::MockAttributeManager::asyncForAttribute not implemented."); } diff --git a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.h b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.h index b44b8480077..dbf84a40e84 100644 --- a/searchlib/src/vespa/searchlib/test/mock_attribute_manager.h +++ b/searchlib/src/vespa/searchlib/test/mock_attribute_manager.h @@ -22,7 +22,7 @@ public: ~MockAttributeManager() override; AttributeGuard::UP getAttribute(const vespalib::string &name) const override; - void asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const override; + void asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override; std::unique_ptr<AttributeReadGuard> getAttributeReadGuard(const vespalib::string &name, bool stableEnumGuard) const override; void getAttributeList(std::vector<AttributeGuard> &list) const override; IAttributeContext::UP createContext() const override; diff --git a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp index 28773b2633f..7497a66d138 100644 --- a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp +++ b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp @@ -71,7 +71,7 @@ public: } void - asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const override { + asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override { LOG_ABORT("MyAttributeContext::asyncForAttribute should not be reached"); } }; @@ -92,7 +92,7 @@ public: } void - asyncForAttribute(const vespalib::string &, std::shared_ptr<IAttributeFunctor>) const override { + asyncForAttribute(const vespalib::string &, std::unique_ptr<IAttributeFunctor>) const override { LOG_ABORT("should not be reached"); } |