summaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/predicate/document_features_store_saver.h
blob: 630ac3900f5be0fda91fd5c56f29dd88d18d753a (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "document_features_store.h"

namespace search { class BufferWriter; }

namespace search::predicate {

/*
 * Class used to save a DocumentFeaturesStore instance, streaming the
 * serialized data via a BufferWriter.
 */
class DocumentFeaturesStoreSaver {
    using RefsVector = DocumentFeaturesStore::RefsVector;
    using FeaturesStore = DocumentFeaturesStore::FeaturesStore;
    using RangesStore = DocumentFeaturesStore::RangesStore;
    using WordStore = DocumentFeaturesStore::WordStore;

    const RefsVector&     _refs;  // TODO: Use copy when saving in flush thread
    const FeaturesStore&  _features;
    const RangesStore&    _ranges;
    const WordStore&      _word_store;
    const uint32_t        _arity;

public:
    DocumentFeaturesStoreSaver(const DocumentFeaturesStore& store);
    ~DocumentFeaturesStoreSaver();
    void save(BufferWriter& writer) const;
};

}