GridGain C++
core/include/ignite/cache/query/query_scan.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 GridGain Systems, Inc. and Contributors.
3  *
4  * Licensed under the GridGain Community Edition License (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #ifndef _IGNITE_CACHE_QUERY_QUERY_SCAN
23 #define _IGNITE_CACHE_QUERY_QUERY_SCAN
24 
25 #include <stdint.h>
26 #include <string>
27 
29 
30 namespace ignite
31 {
32  namespace cache
33  {
34  namespace query
35  {
39  class ScanQuery
40  {
41  public:
45  ScanQuery() : part(-1), pageSize(1024), loc(false)
46  {
47  // No-op.
48  }
49 
55  ScanQuery(int32_t part) : part(part), pageSize(1024), loc(false)
56  {
57  // No-op.
58  }
59 
65  int32_t GetPartition() const
66  {
67  return part;
68  }
69 
75  void SetPartition(int32_t part)
76  {
77  this->part = part;
78  }
79 
85  int32_t GetPageSize() const
86  {
87  return pageSize;
88  }
89 
95  void SetPageSize(int32_t pageSize)
96  {
97  this->pageSize = pageSize;
98  }
99 
105  bool IsLocal() const
106  {
107  return loc;
108  }
109 
117  void SetLocal(bool loc)
118  {
119  this->loc = loc;
120  }
121 
127  void Write(binary::BinaryRawWriter& writer) const
128  {
129  writer.WriteBool(loc);
130  writer.WriteInt32(pageSize);
131 
132  if (part < 0)
133  writer.WriteBool(false);
134  else
135  {
136  writer.WriteBool(true);
137  writer.WriteInt32(part);
138  }
139 
140  writer.WriteNull(); // Predicates are not supported yet.
141  }
142 
143  private:
145  int32_t part;
146 
148  int32_t pageSize;
149 
151  bool loc;
152  };
153  }
154  }
155 }
156 
157 #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:75
ignite
Ignite API.
Definition: cache.h:47
ignite::binary::BinaryRawWriter::WriteInt32
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:71
ignite::cache::query::ScanQuery::IsLocal
bool IsLocal() const
Get local flag.
Definition: core/include/ignite/cache/query/query_scan.h:105
ignite::cache::query::ScanQuery
Scan query.
Definition: core/include/ignite/cache/query/query_scan.h:39
ignite::cache::query::ScanQuery::SetPageSize
void SetPageSize(int32_t pageSize)
Set page size.
Definition: core/include/ignite/cache/query/query_scan.h:95
ignite::binary::BinaryRawWriter
Binary raw writer.
Definition: binary_raw_writer.h:61
ignite::binary::BinaryRawWriter::WriteBool
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:41
ignite::cache::query::ScanQuery::GetPageSize
int32_t GetPageSize() const
Get page size.
Definition: core/include/ignite/cache/query/query_scan.h:85
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery(int32_t part)
Constructor.
Definition: core/include/ignite/cache/query/query_scan.h:55
ignite::cache::query::ScanQuery::GetPartition
int32_t GetPartition() const
Get partition to scan.
Definition: core/include/ignite/cache/query/query_scan.h:65
binary_raw_writer.h
ignite::cache::query::ScanQuery::ScanQuery
ScanQuery()
Default constructor.
Definition: core/include/ignite/cache/query/query_scan.h:45
ignite::cache::query::ScanQuery::SetLocal
void SetLocal(bool loc)
Set local flag.
Definition: core/include/ignite/cache/query/query_scan.h:117
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:127
ignite::binary::BinaryRawWriter::WriteNull
void WriteNull()
Write NULL value.
Definition: binary_raw_writer.cpp:176