blob: 59baaf0b6dc892728c744beca59e748ccb94897c (
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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/datastore/atomic_entry_ref.h>
#include <vespa/vespalib/util/rcuvector.h>
namespace search::attribute { class BlobSequenceReader; }
namespace vespalib { class Executor; }
namespace search::tensor {
class DenseTensorStore;
class NearestNeighborIndex;
class TensorAttribute;
class TensorStore;
/**
* Class for loading a tensor attribute.
* Will also load the nearest neighbor index.
*/
class TensorAttributeLoader {
using AtomicEntryRef = vespalib::datastore::AtomicEntryRef;
using GenerationHandler = vespalib::GenerationHandler;
using RefVector = vespalib::RcuVectorBase<AtomicEntryRef>;
TensorAttribute& _attr;
GenerationHandler& _generation_handler;
RefVector& _ref_vector;
TensorStore& _store;
NearestNeighborIndex* _index;
void load_dense_tensor_store(search::attribute::BlobSequenceReader& reader, uint32_t docid_limit, DenseTensorStore& dense_store);
void load_tensor_store(search::attribute::BlobSequenceReader& reader, uint32_t docid_limit);
void build_index(vespalib::Executor* executor, uint32_t docid_limit);
bool load_index();
void check_consistency(uint32_t docid_limit);
public:
TensorAttributeLoader(TensorAttribute& attr, GenerationHandler& generation_handler, RefVector& ref_vector, TensorStore& store, NearestNeighborIndex* index);
~TensorAttributeLoader();
bool on_load(vespalib::Executor* executor);
};
}
|