blob: 320cc34f18eba70ad7e7fa7e1d6de4f609a514ec (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "multivalueattributesaver.h"
#include "enumattributesaver.h"
#include "multi_value_mapping.h"
#include <vespa/searchcommon/attribute/multi_value_traits.h>
namespace search {
/**
* Class for saving an enumerated multivalue attribute.
*
* Template argument MultiValueT is either ValueType or
* multivalue::WeightedValue<ValueType>
*/
template <typename MultiValueT>
class MultiValueEnumAttributeSaver : public MultiValueAttributeSaver
{
using Parent = MultiValueAttributeSaver;
using MultiValueType = MultiValueT;
using ValueType = multivalue::ValueType_t<MultiValueType>;
using GenerationHandler = vespalib::GenerationHandler;
using Parent::_frozenIndices;
using MultiValueMapping = attribute::MultiValueMapping<MultiValueType>;
const MultiValueMapping &_mvMapping;
EnumAttributeSaver _enumSaver;
const IEnumStore &_enum_store;
uint64_t _compaction_count;
bool compaction_interferred() const;
public:
bool onSave(IAttributeSaveTarget &saveTarget) override;
MultiValueEnumAttributeSaver(GenerationHandler::Guard &&guard,
const attribute::AttributeHeader &header,
const MultiValueMapping &mvMapping,
IEnumStore &enumStore);
~MultiValueEnumAttributeSaver() override;
};
} // namespace search
|