olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
Partitions.h
1/*
2 * Copyright (C) 2019-2023 HERE Europe B.V.
3 *
4 * Licensed under the Apache License, Version 2.0 (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 * http://www.apache.org/licenses/LICENSE-2.0
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 * SPDX-License-Identifier: Apache-2.0
17 * License-Filename: LICENSE
18 */
19
20#pragma once
21
22#include <string>
23#include <utility>
24#include <vector>
25
26#include <olp/core/porting/optional.h>
27#include <olp/dataservice/read/DataServiceReadApi.h>
28
29namespace olp {
30namespace dataservice {
31namespace read {
32namespace model {
33
37class DATASERVICE_READ_API Partition {
38 public:
39 Partition() = default;
40 Partition(const Partition&) = default;
41 Partition(Partition&&) = default;
42 Partition& operator=(const Partition&) = default;
43 Partition& operator=(Partition&&) = default;
44 virtual ~Partition() = default;
45
46 private:
47 porting::optional<std::string> checksum_;
48 porting::optional<int64_t> compressed_data_size_;
49 std::string data_handle_;
50 porting::optional<int64_t> data_size_;
51 porting::optional<std::string> crc_;
52 std::string partition_;
53 porting::optional<int64_t> version_;
54
55 public:
68 const porting::optional<std::string>& GetChecksum() const {
69 return checksum_;
70 }
78 porting::optional<std::string>& GetMutableChecksum() { return checksum_; }
86 void SetChecksum(porting::optional<std::string> value) {
87 this->checksum_ = std::move(value);
88 }
89
101 const porting::optional<int64_t>& GetCompressedDataSize() const {
102 return compressed_data_size_;
103 }
113 porting::optional<int64_t>& GetMutableCompressedDataSize() {
114 return compressed_data_size_;
115 }
124 void SetCompressedDataSize(porting::optional<int64_t> value) {
125 this->compressed_data_size_ = value;
126 }
127
139 const std::string& GetDataHandle() const { return data_handle_; }
147 std::string& GetMutableDataHandle() { return data_handle_; }
155 void SetDataHandle(std::string value) {
156 this->data_handle_ = std::move(value);
157 }
158
170 const porting::optional<int64_t>& GetDataSize() const { return data_size_; }
181 porting::optional<int64_t>& GetMutableDataSize() { return data_size_; }
190 void SetDataSize(porting::optional<int64_t> value) {
191 this->data_size_ = value;
192 }
193
203 const porting::optional<std::string>& GetCrc() const { return crc_; }
211 porting::optional<std::string>& GetMutableCrc() { return crc_; }
219 void SetCrc(porting::optional<std::string> value) {
220 this->crc_ = std::move(value);
221 }
222
233 const std::string& GetPartition() const { return partition_; }
241 std::string& GetMutablePartition() { return partition_; }
249 void SetPartition(std::string value) { this->partition_ = std::move(value); }
250
261 const porting::optional<int64_t>& GetVersion() const { return version_; }
271 porting::optional<int64_t>& GetMutableVersion() { return version_; }
280 void SetVersion(porting::optional<int64_t> value) { this->version_ = value; }
281};
282
287 public:
288 Partitions() = default;
289 Partitions(const Partitions&) = default;
290 Partitions(Partitions&&) = default;
291 Partitions& operator=(const Partitions&) = default;
292 Partitions& operator=(Partitions&&) = default;
293 virtual ~Partitions() = default;
294
295 private:
296 std::vector<Partition> partitions_;
297
298 public:
304 const std::vector<Partition>& GetPartitions() const { return partitions_; }
311 std::vector<Partition>& GetMutablePartitions() { return partitions_; }
317 void SetPartitions(std::vector<Partition> value) {
318 this->partitions_ = std::move(value);
319 }
320};
321
322} // namespace model
323} // namespace read
324} // namespace dataservice
325} // namespace olp
A model that represents a partition in a layer.
Definition Partitions.h:37
const porting::optional< int64_t > & GetDataSize() const
(Optional) Gets the uncompressed size of the partition data in bytes.
Definition Partitions.h:170
const porting::optional< int64_t > & GetCompressedDataSize() const
(Optional) Gets the compressed size of the partition data in bytes when data compression is enabled.
Definition Partitions.h:101
void SetDataSize(porting::optional< int64_t > value)
(Optional) Sets the uncompressed size of the partition data.
Definition Partitions.h:190
void SetPartition(std::string value)
Sets the partition key.
Definition Partitions.h:249
const porting::optional< std::string > & GetCrc() const
Definition Partitions.h:203
void SetCompressedDataSize(porting::optional< int64_t > value)
(Optional) Sets the compressed size of the partition data.
Definition Partitions.h:124
const std::string & GetDataHandle() const
Get the partition data handle.
Definition Partitions.h:139
void SetCrc(porting::optional< std::string > value)
(Optional) Sets the partition crc.
Definition Partitions.h:219
std::string & GetMutableDataHandle()
Gets a mutable reference to the partition data handle.
Definition Partitions.h:147
porting::optional< int64_t > & GetMutableDataSize()
(Optional) Gets a mutable reference to the uncompressed size of the partition data in bytes.
Definition Partitions.h:181
porting::optional< std::string > & GetMutableCrc()
(Optional) Gets a mutable reference to the partition crc.
Definition Partitions.h:211
const porting::optional< std::string > & GetChecksum() const
(Optional) Gets the partition checksum.
Definition Partitions.h:68
void SetDataHandle(std::string value)
Sets the partition data handle.
Definition Partitions.h:155
const porting::optional< int64_t > & GetVersion() const
(Optional) Gets the version of the catalog when this partition was last changed.
Definition Partitions.h:261
porting::optional< std::string > & GetMutableChecksum()
(Optional) Gets a mutable reference to the partition checksum.
Definition Partitions.h:78
const std::string & GetPartition() const
Gets the partition key.
Definition Partitions.h:233
porting::optional< int64_t > & GetMutableVersion()
(Optional) Gets a mutable reference to the version of the catalog when this partition was last change...
Definition Partitions.h:271
std::string & GetMutablePartition()
Gets a mutable reference to the partition key.
Definition Partitions.h:241
void SetVersion(porting::optional< int64_t > value)
(Optional) Sets the partition version.
Definition Partitions.h:280
porting::optional< int64_t > & GetMutableCompressedDataSize()
(Optional) Gets a mutable reference to the compressed size of the partition data in bytes when data c...
Definition Partitions.h:113
void SetChecksum(porting::optional< std::string > value)
(Optional) Sets the partition checksum.
Definition Partitions.h:86
A model that represents a collection of layer partitions.
Definition Partitions.h:286
std::vector< Partition > & GetMutablePartitions()
Gets a mutable reference to the list of partitions for the given layer and layer version.
Definition Partitions.h:311
const std::vector< Partition > & GetPartitions() const
Gets the list of partitions for the given layer and layer version.
Definition Partitions.h:304
void SetPartitions(std::vector< Partition > value)
Sets the list of partitions.
Definition Partitions.h:317
Rules all the other namespaces.
Definition AppleSignInProperties.h:24