aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h
blob: 406739aac94063213e70ae1534be4c1a1cc35d27 (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
38
39
40
41
42
43
44
45
46
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "attribute_spec.h"
#include <vespa/searchlib/common/serialnum.h>
#include <optional>
#include <vector>

namespace proton {

/**
 * A specification of which attribute vectors an attribute manager should instantiate and manage.
 */
class AttributeCollectionSpec
{
public:
    using AttributeList = std::vector<AttributeSpec>;

private:
    using SerialNum = search::SerialNum;

    AttributeList _attributes;
    uint32_t      _docIdLimit;
    std::optional<SerialNum> _currentSerialNum;

public:
    AttributeCollectionSpec(AttributeList && attributes, uint32_t docIdLimit, std::optional<SerialNum> currentSerialNum);
    ~AttributeCollectionSpec();
    const AttributeList &getAttributes() const {
        return _attributes;
    }
    AttributeList stealAttributes() {
        return std::move(_attributes);
    }
    uint32_t getDocIdLimit() const {
        return _docIdLimit;
    }
    const std::optional<SerialNum>& getCurrentSerialNum() const noexcept {
        return _currentSerialNum;
    }
    bool hasAttribute(const vespalib::string &name) const;
};

} // namespace proton