summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-08-23 11:24:57 +0200
committerGitHub <noreply@github.com>2018-08-23 11:24:57 +0200
commit50a47fc6a5cf4cb2104f18a94290946f227bec06 (patch)
tree136ae410ed69f827944486c8139cbeb2a8809eec /searchcore
parentdd34698bcd051c1eff8d94506a7ac7a1545ee1d2 (diff)
parent5c1be20f5d5073ea6d9be66f80ed921b0d1a3cce (diff)
Merge pull request #6636 from vespa-engine/balder/add-attribute_operation
Balder/add attribute operation
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/i_attribute_functor.h22
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp4
8 files changed, 18 insertions, 47 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
index ce09a9a3742..bd539999b5d 100644
--- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
@@ -8,7 +8,6 @@
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h>
-#include <vespa/searchcore/proton/attribute/i_attribute_functor.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/attribute/sequential_attributes_initializer.h>
#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
@@ -20,6 +19,7 @@
#include <vespa/searchcore/proton/test/attribute_utils.h>
#include <vespa/searchcore/proton/test/attribute_vectors.h>
#include <vespa/searchlib/attribute/attributefactory.h>
+#include <vespa/searchlib/attribute/i_attribute_functor.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/imported_attribute_vector.h>
@@ -79,7 +79,7 @@ namespace {
const uint64_t createSerialNum = 42u;
-class MyAttributeFunctor : public proton::IAttributeFunctor
+class MyAttributeFunctor : public search::attribute::IAttributeFunctor
{
std::vector<vespalib::string> _names;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp
index b8aceb83dc7..e271f2f0bef 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.cpp
@@ -14,13 +14,10 @@ AttributeUsageSamplerFunctor::AttributeUsageSamplerFunctor(
{
}
-AttributeUsageSamplerFunctor::~AttributeUsageSamplerFunctor()
-{
-}
+AttributeUsageSamplerFunctor::~AttributeUsageSamplerFunctor() = default;
void
-AttributeUsageSamplerFunctor::operator()(const search::AttributeVector &
- attributeVector)
+AttributeUsageSamplerFunctor::operator()(const search::AttributeVector & attributeVector)
{
// Executed by attribute writer thread
search::AddressSpaceUsage usage = attributeVector.getAddressSpaceUsage();
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.h
index c2c09e06545..1b06e1dff45 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_sampler_functor.h
@@ -2,7 +2,7 @@
#pragma once
-#include "i_attribute_functor.h"
+#include <vespa/searchlib/attribute/i_attribute_functor.h>
#include <memory>
namespace proton {
@@ -13,17 +13,15 @@ class AttributeUsageSamplerContext;
* Functor for sampling attribute usage and passing it on to sampler
* context.
*/
-class AttributeUsageSamplerFunctor : public IAttributeFunctor
+class AttributeUsageSamplerFunctor : public search::attribute::IAttributeFunctor
{
std::shared_ptr<AttributeUsageSamplerContext> _samplerContext;
std::string _subDbName;
public:
- AttributeUsageSamplerFunctor(std::shared_ptr<AttributeUsageSamplerContext>
- samplerContext,
+ AttributeUsageSamplerFunctor(std::shared_ptr<AttributeUsageSamplerContext> samplerContext,
const std::string &subDbname);
- ~AttributeUsageSamplerFunctor();
- virtual void
- operator()(const search::AttributeVector &attributeVector) override;
+ ~AttributeUsageSamplerFunctor() override;
+ void operator()(const search::AttributeVector &attributeVector) override;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index 87248e060c9..d0a1e891150 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -4,7 +4,6 @@
#include "attribute_directory.h"
#include "attributedisklayout.h"
#include "attributemanager.h"
-#include "i_attribute_functor.h"
#include "imported_attributes_context.h"
#include "imported_attributes_repo.h"
#include "sequential_attributes_initializer.h"
@@ -12,6 +11,7 @@
#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchlib/attribute/attributecontext.h>
#include <vespa/searchlib/attribute/attribute_read_guard.h>
+#include <vespa/searchlib/attribute/i_attribute_functor.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
#include <vespa/searchlib/common/threaded_compactable_lid_space.h>
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 79ef162adce..48332bedbb7 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
@@ -1,10 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "filter_attribute_manager.h"
-#include "i_attribute_functor.h"
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/searchlib/attribute/attributevector.h>
+#include <vespa/searchlib/attribute/i_attribute_functor.h>
#include <vespa/searchlib/attribute/attribute_read_guard.h>
using search::AttributeGuard;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_functor.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_functor.h
deleted file mode 100644
index 26dfebf1e73..00000000000
--- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_functor.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-namespace search { class AttributeVector; }
-
-namespace proton {
-
-/*
- * Interface class for access attribute in correct attribute write
- * thread as async callback from asyncForEachAttribute() call on
- * attribute manager.
- */
-class IAttributeFunctor
-{
-public:
- virtual void operator()(const search::AttributeVector &attributeVector) = 0;
- virtual ~IAttributeFunctor() { }
-};
-
-} // namespace proton
-
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
index ca4a1a28c77..dd8f9a5df90 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
@@ -10,13 +10,13 @@
#include <vespa/searchlib/common/serialnum.h>
namespace search {
-class IDestructorCallback;
-class ISequencedTaskExecutor;
+ class IDestructorCallback;
+ class ISequencedTaskExecutor;
}
+namespace search::attribute { class IAttributeFunctor; }
namespace proton {
-class IAttributeFunctor;
class ImportedAttributesRepo;
/**
@@ -27,11 +27,9 @@ class ImportedAttributesRepo;
*/
struct IAttributeManager : public search::IAttributeManager
{
- typedef std::shared_ptr<IAttributeManager> SP;
-
+ using SP = std::shared_ptr<IAttributeManager>;
using OnWriteDoneType = const std::shared_ptr<search::IDestructorCallback> &;
-
- virtual ~IAttributeManager() {}
+ using IAttributeFunctor = search::attribute::IAttributeFunctor;
/**
* Create a new attribute manager based on the content of the current one and
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 3c9f57dc02b..9b5f898495c 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -303,7 +303,7 @@ MatchThread::processResult(const Doom & hardDoom,
}
if (hardDoom.doom()) return;
size_t totalHits = result->getNumHits();
- search::RankedHit *hits = result->getArray();
+ const search::RankedHit *hits = result->getArray();
size_t numHits = result->getArrayUsed();
search::BitVector *bits = result->getBitOverflow();
if (bits != nullptr && hits != nullptr) {
@@ -316,7 +316,7 @@ MatchThread::processResult(const Doom & hardDoom,
}
if (hardDoom.doom()) return;
size_t sortLimit = hasGrouping ? numHits : context.result->maxSize();
- context.sort->sorter->sortResults(hits, numHits, sortLimit);
+ result->sort(*context.sort->sorter, sortLimit);
if (hardDoom.doom()) return;
if (hasGrouping) {
search::grouping::GroupingManager man(*context.grouping);