be/src/storage/index/index_iterator.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <memory> |
21 | | #include <variant> |
22 | | |
23 | | #include "common/status.h" |
24 | | #include "storage/index/index_reader.h" |
25 | | |
26 | | namespace doris::segment_v2 { |
27 | | |
28 | | struct AnnTopNParam; |
29 | | struct IndexQueryContext; |
30 | | using IndexQueryContextPtr = std::shared_ptr<IndexQueryContext>; |
31 | | |
32 | | class InvertedIndexQueryCacheHandle; |
33 | | enum class InvertedIndexReaderType; |
34 | | |
35 | | struct InvertedIndexParam; |
36 | | using IndexParam = std::variant<InvertedIndexParam*, segment_v2::AnnTopNParam*>; |
37 | | |
38 | | enum class AnnIndexReaderType { |
39 | | ANN = 0, |
40 | | }; |
41 | | |
42 | | using IndexReaderType = std::variant<InvertedIndexReaderType, AnnIndexReaderType>; |
43 | | class IndexIterator { |
44 | | public: |
45 | 3.04k | IndexIterator() = default; |
46 | 3.04k | virtual ~IndexIterator() = default; |
47 | | |
48 | | virtual IndexReaderPtr get_reader(IndexReaderType reader_type) const = 0; |
49 | | virtual Status read_from_index(const IndexParam& param) = 0; |
50 | | |
51 | | virtual Status read_null_bitmap(InvertedIndexQueryCacheHandle* cache_handle) = 0; |
52 | | virtual Result<bool> has_null() = 0; |
53 | | |
54 | 2.75k | void set_context(const IndexQueryContextPtr& context) { _context = context; } |
55 | 0 | IndexQueryContextPtr get_context() const { return _context; } |
56 | | |
57 | | protected: |
58 | | IndexQueryContextPtr _context = nullptr; |
59 | | }; |
60 | | |
61 | | } // namespace doris::segment_v2 |