aboutsummaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-24 19:52:07 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-27 09:22:14 +0200
commitf19fa359f112f0009a4a39e9e8358a5458ca4fb2 (patch)
treea48dc619eadb646480ee1cabca0d596e9b795f09 /searchcommon
parentbe6729d2eadb3abe61613acb82c59a137ccf12a0 (diff)
Wire in the attribute execution via the IAttributeContext.
Also execution in a task for containment.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h29
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributecontext.h3
2 files changed, 31 insertions, 1 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h b/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h
new file mode 100644
index 00000000000..3ef9d2abf1a
--- /dev/null
+++ b/searchcommon/src/vespa/searchcommon/attribute/i_attribute_functor.h
@@ -0,0 +1,29 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/vespalib/stllike/string.h>
+
+namespace search::attribute {
+
+class IAttributeVector;
+
+/*
+ * 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 IAttributeVector &attributeVector) = 0;
+ virtual ~IAttributeFunctor() { }
+};
+
+class IAttributeExecutor {
+public:
+ virtual ~IAttributeExecutor() { }
+ virtual void asyncForAttribute(const vespalib::string &name, std::shared_ptr<IAttributeFunctor> func) const = 0;
+};
+
+}
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributecontext.h b/searchcommon/src/vespa/searchcommon/attribute/iattributecontext.h
index c283abf3ced..b80711a2e76 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributecontext.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributecontext.h
@@ -2,6 +2,7 @@
#pragma once
+#include "i_attribute_functor.h"
#include "iattributevector.h"
namespace search::attribute {
@@ -9,7 +10,7 @@ namespace search::attribute {
/**
* This is an interface used to access all registered attribute vectors.
**/
-class IAttributeContext {
+class IAttributeContext : public IAttributeExecutor {
public:
typedef vespalib::string string;
/** Convenience typedefs **/