summaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/tensor/streamed_value_saver.h
blob: 0ce864769f7964e1846b7278b13dc7fa7bde3066 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/attribute/attributesaver.h>
#include "tensor_attribute.h"

namespace search::tensor {

class TensorBufferStore;

/*
 * Class for saving a tensor attribute.
 */
class StreamedValueSaver : public AttributeSaver
{
public:
    using RefCopyVector = TensorAttribute::RefCopyVector;
private:
    using GenerationHandler = vespalib::GenerationHandler;

    RefCopyVector _refs;
    const TensorBufferStore &_tensorStore;

    bool onSave(IAttributeSaveTarget &saveTarget) override;
public:
    StreamedValueSaver(GenerationHandler::Guard &&guard,
                       const attribute::AttributeHeader &header,
                       RefCopyVector &&refs,
                       const TensorBufferStore &tensorStore);

    virtual ~StreamedValueSaver();
};

} // namespace search::tensor