/Users/deen/code/yugabyte-db/src/yb/docdb/ql_rowwise_iterator_interface.h
Line | Count | Source |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #ifndef YB_DOCDB_QL_ROWWISE_ITERATOR_INTERFACE_H |
15 | | #define YB_DOCDB_QL_ROWWISE_ITERATOR_INTERFACE_H |
16 | | |
17 | | #include <memory> |
18 | | |
19 | | #include "yb/common/common_fwd.h" |
20 | | |
21 | | #include "yb/docdb/docdb_fwd.h" |
22 | | |
23 | | #include "yb/util/status_fwd.h" |
24 | | |
25 | | namespace yb { |
26 | | |
27 | | class Slice; |
28 | | |
29 | | namespace docdb { |
30 | | |
31 | | class YQLRowwiseIteratorIf { |
32 | | public: |
33 | | typedef std::unique_ptr<YQLRowwiseIteratorIf> UniPtr; |
34 | 8.42M | virtual ~YQLRowwiseIteratorIf() {} |
35 | | |
36 | | //------------------------------------------------------------------------------------------------ |
37 | | // Pure virtual API methods. |
38 | | //------------------------------------------------------------------------------------------------ |
39 | | // Checks whether next row exists. |
40 | | virtual Result<bool> HasNext() const = 0; |
41 | | |
42 | | // Skip the current row. |
43 | | virtual void SkipRow() = 0; |
44 | | |
45 | | // If restart is required returns restart hybrid time, based on iterated records. |
46 | | // Otherwise returns invalid hybrid time. |
47 | | virtual HybridTime RestartReadHt() = 0; |
48 | | |
49 | | virtual std::string ToString() const = 0; |
50 | | |
51 | | virtual const Schema& schema() const = 0; |
52 | | |
53 | | //------------------------------------------------------------------------------------------------ |
54 | | // Virtual API methods. |
55 | | // These methods are not applied to virtual/system table. |
56 | | //------------------------------------------------------------------------------------------------ |
57 | | |
58 | | // Apache Cassandra Only: CQL supports static columns while all other intefaces do not. |
59 | | // Is the next row column to read a static column? |
60 | 2.33M | virtual bool IsNextStaticColumn() const { |
61 | 2.33M | return false; |
62 | 2.33M | } |
63 | | |
64 | | // Retrieves the next key to read after the iterator finishes for the given page. |
65 | | virtual CHECKED_STATUS GetNextReadSubDocKey(SubDocKey* sub_doc_key) const; |
66 | | |
67 | | // Returns the tuple id of the current tuple. See DocRowwiseIterator for details. |
68 | | virtual Result<Slice> GetTupleId() const; |
69 | | |
70 | | // Seeks to the given tuple by its id. See DocRowwiseIterator for details. |
71 | | virtual Result<bool> SeekTuple(const Slice& tuple_id); |
72 | | |
73 | | //------------------------------------------------------------------------------------------------ |
74 | | // Common API methods. |
75 | | //------------------------------------------------------------------------------------------------ |
76 | | // Read next row using the specified projection. |
77 | | CHECKED_STATUS NextRow(const Schema& projection, QLTableRow* table_row); |
78 | | |
79 | | CHECKED_STATUS NextRow(QLTableRow* table_row); |
80 | | |
81 | | private: |
82 | | virtual CHECKED_STATUS DoNextRow(const Schema& projection, QLTableRow* table_row) = 0; |
83 | | }; |
84 | | |
85 | | } // namespace docdb |
86 | | } // namespace yb |
87 | | |
88 | | #endif // YB_DOCDB_QL_ROWWISE_ITERATOR_INTERFACE_H |