Apache Ignite C++
core/include/ignite/cache/query/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 
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 
118  void SetLocal(bool loc)
119  {
120  this->loc = loc;
121  }
122 
128  void Write(binary::BinaryRawWriter& writer) const
129  {
130  writer.WriteBool(loc);
131  writer.WriteInt32(pageSize);
132 
133  if (part < 0)
134  writer.WriteBool(false);
135  else
136  {
137  writer.WriteBool(true);
138  writer.WriteInt32(part);
139  }
140 
141  writer.WriteNull(); // Predicates are not supported yet.
142  }
143 
144  private:
146  int32_t part;
147 
149  int32_t pageSize;
150 
152  bool loc;
153  };
154  }
155  }
156 }
157 
158 #endif //_IGNITE_CACHE_QUERY_QUERY_SCAN
ignite::cache::query::ScanQuery::SetPartition
void SetPartition(int32_t part)
Set partition to scan.
Definition: core/include/ignite/cache/query/query_scan.h:76
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::binary::BinaryRawWriter::WriteInt32
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:72
ignite::cache::query::ScanQuery::IsLocal
bool IsLocal() const
Get local flag.
Definition: core/include/ignite/cache/query/query_scan.h:106
ignite::cache::query::ScanQuery
Scan query.
Definition: core/include/ignite/cache/query/query_scan.h:40
ignite::cache::query::ScanQuery::SetPageSize
void SetPageSize(int32_t pageSize)
Set page size.
Definition: core/include/ignite/cache/query/query_scan.h:96
ignite::binary::BinaryRawWriter
Binary raw writer.
Definition: binary_raw_writer.h:62
ignite::binary::BinaryRawWriter::WriteBool
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:42
ignite::cache::query::ScanQuery::GetPageSize
int32_t GetPageSize() const
Get page size.
Definition: core/include/ignite/cache/query/query_scan.h:86
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery(int32_t part)
Constructor.
Definition: core/include/ignite/cache/query/query_scan.h:56
ignite::cache::query::ScanQuery::GetPartition
int32_t GetPartition() const
Get partition to scan.
Definition: core/include/ignite/cache/query/query_scan.h:66
binary_raw_writer.h
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery()
Default constructor.
Definition: core/include/ignite/cache/query/query_scan.h:46
ignite::cache::query::ScanQuery::SetLocal
void SetLocal(bool loc)
Set local flag.
Definition: core/include/ignite/cache/query/query_scan.h:118
ignite::cache::query::ScanQuery::Write
void Write(binary::BinaryRawWriter &writer) const
Write query info to the stream.
Definition: core/include/ignite/cache/query/query_scan.h:128
ignite::binary::BinaryRawWriter::WriteNull
void WriteNull()
Write NULL value.
Definition: binary_raw_writer.cpp:177