summaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/tensor/direct_tensor_saver.h
blob: 132e1570f0ff71a305e4e27c5aa376def95d86c0 (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 DirectTensorStore;

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

    RefCopyVector _refs;
    const DirectTensorStore &_tensorStore;

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

    virtual ~DirectTensorAttributeSaver();
};

} // namespace search::tensor