aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/i_attribute_functor.h
blob: cb93d1fea5c613a6df1a42ffe895e0b692a7ac48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <memory>

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 IConstAttributeFunctor
{
public:
    virtual void operator()(const IAttributeVector &attributeVector) = 0;
    virtual ~IConstAttributeFunctor() = default;
};

class IAttributeFunctor
{
public:
    virtual void operator()(IAttributeVector &attributeVector) = 0;
    virtual ~IAttributeFunctor() = default;
};

class IAttributeExecutor {
public:
    virtual ~IAttributeExecutor() = default;
    virtual void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const = 0;
};

}