aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h
blob: 77d3456169085cabf3e20a2b5e64b1fc952cf19b (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/common/serialnum.h>
#include <vespa/vespalib/stllike/string.h>
#include <memory>
#include <optional>

namespace search { class AttributeVector; }
namespace search::attribute { class Config; }

namespace proton {

/**
 * Interface for a factory for creating and setting up attribute vectors used by
 * an attribute manager.
 */
struct IAttributeFactory
{
    using SP = std::shared_ptr<IAttributeFactory>;
    using AttributeVectorSP = std::shared_ptr<search::AttributeVector>;
    virtual ~IAttributeFactory() {}
    virtual AttributeVectorSP create(const vespalib::string &name,
                                     const search::attribute::Config &cfg) const = 0;
    virtual void setupEmpty(const AttributeVectorSP &vec,
                            std::optional<search::SerialNum> serialNum) const = 0;
};

} // namespace proton