aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/streamed/streamed_value_index.h
blob: e94462c89f429b18084df5a304d34542cee14d4c (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 Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/value.h>
#include <vespa/vespalib/util/shared_string_repo.h>

namespace vespalib::eval {

 /**
  *  Implements Value::Index by reading a stream of serialized
  *  labels.
  **/
class StreamedValueIndex : public Value::Index
{
private:
    uint32_t _num_mapped_dims;
    uint32_t _num_subspaces;
    const std::vector<string_id> &_labels_ref;

public:
    StreamedValueIndex(uint32_t num_mapped_dims, uint32_t num_subspaces, const std::vector<string_id> &labels_ref)
        : _num_mapped_dims(num_mapped_dims),
          _num_subspaces(num_subspaces),
          _labels_ref(labels_ref)
    {}

    // index API:
    size_t size() const override { return _num_subspaces; }
    std::unique_ptr<View> create_view(const std::vector<size_t> &dims) const override;
};

} // namespace