| Apache Ignite C++

query_scan.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_CACHE_QUERY_QUERY_SCAN
24 #define _IGNITE_CACHE_QUERY_QUERY_SCAN
25
26 #include <stdint.h>
27 #include <string>
28
29 #include "ignite/binary/binary_raw_writer.h"
30
31 namespace ignite
32 {
33 namespace cache
34 {
35 namespace query
36 {
40 class ScanQuery
41 {
42 public:
46 ScanQuery() : part(-1), pageSize(1024), loc(false)
47 {
48 // No-op.
49 }
50
56 ScanQuery(int32_t part) : part(part), pageSize(1024), loc(false)
57 {
58 // No-op.
59 }
60
66 int32_t GetPartition() const
67 {
68 return part;
69 }
70
76 void SetPartition(int32_t part)
77 {
78 this->part = part;
79 }
80
86 int32_t GetPageSize() const
87 {
88 return pageSize;
89 }
90
96 void SetPageSize(int32_t pageSize)
97 {
98 this->pageSize = pageSize;
99 }
100
106 bool IsLocal() const
107 {
108 return loc;
109 }
110
116 void SetLocal(bool loc)
117 {
118 this->loc = loc;
119 }
120
126 void Write(binary::BinaryRawWriter& writer) const
127 {
128 writer.WriteBool(loc);
129 writer.WriteInt32(pageSize);
130
131 if (part < 0)
132 writer.WriteBool(false);
133 else
134 {
135 writer.WriteBool(true);
136 writer.WriteInt32(part);
137 }
138
139 writer.WriteNull(); // Predicates are not supported yet.
140 }
141
142 private:
144 int32_t part;
145
147 int32_t pageSize;
148
150 bool loc;
151 };
152 }
153 }
154 }
155
156 #endif //_IGNITE_CACHE_QUERY_QUERY_SCAN
ignite::cache::query::ScanQuery::SetPartition
void SetPartition(int32_t part)
Set partition to scan.
Definition: query_scan.h:76
ignite::binary::BinaryRawWriter::WriteNull
void WriteNull()
Write NULL value.
Definition: binary_raw_writer.cpp:177
binary_raw_writer.h
Declares ignite::binary::BinaryRawWriter class.
ignite::binary::BinaryRawWriter::WriteInt32
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:72
ignite::cache::query::ScanQuery::Write
void Write(binary::BinaryRawWriter &writer) const
Write query info to the stream.
Definition: query_scan.h:126
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery(int32_t part)
Constructor.
Definition: query_scan.h:56
ignite::cache::query::ScanQuery::SetPageSize
void SetPageSize(int32_t pageSize)
Set page size.
Definition: query_scan.h:96
ignite::cache::query::ScanQuery
Scan query.
Definition: query_scan.h:40
ignite::binary::BinaryRawWriter
Binary raw writer.
Definition: binary_raw_writer.h:55
ignite::cache::query::ScanQuery::SetLocal
void SetLocal(bool loc)
Set local flag.
Definition: query_scan.h:116
ignite::binary::BinaryRawWriter::WriteBool
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:42
ignite::cache::query::ScanQuery::GetPartition
int32_t GetPartition() const
Get partition to scan.
Definition: query_scan.h:66
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery()
Default constructor.
Definition: query_scan.h:46
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::cache::query::ScanQuery::GetPageSize
int32_t GetPageSize() const
Get page size.
Definition: query_scan.h:86
ignite::cache::query::ScanQuery::IsLocal
bool IsLocal() const
Get local flag.
Definition: query_scan.h:106