olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
Messages.h
1/*
2 * Copyright (C) 2020-2021 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#include <olp/dataservice/read/model/Data.h>
29#include <olp/dataservice/read/model/StreamOffsets.h>
30
31namespace olp {
32namespace dataservice {
33namespace read {
34namespace model {
35
39class DATASERVICE_READ_API Metadata final {
40 public:
50 const std::string& GetPartition() const { return partition_; }
56 void SetPartition(std::string value) { partition_ = std::move(value); }
57
68 const porting::optional<std::string>& GetChecksum() const {
69 return checksum_;
70 }
78 void SetChecksum(porting::optional<std::string> value) {
79 checksum_ = std::move(value);
80 }
81
91 const porting::optional<int64_t>& GetCompressedDataSize() const {
92 return compressed_data_size_;
93 }
102 void SetCompressedDataSize(porting::optional<int64_t> value) {
103 compressed_data_size_ = value;
104 }
105
116 const porting::optional<int64_t>& GetDataSize() const { return data_size_; }
124 void SetDataSize(porting::optional<int64_t> value) { data_size_ = value; }
125
135 const Data& GetData() const { return data_; }
141 void SetData(Data value) { data_ = std::move(value); }
142
157 const porting::optional<std::string>& GetDataHandle() const {
158 return data_handle_;
159 }
160
168 void SetDataHandle(porting::optional<std::string> value) {
169 data_handle_ = std::move(value);
170 }
171
180 const porting::optional<int64_t>& GetTimestamp() const { return timestamp_; }
188 void SetTimestamp(porting::optional<int64_t> value) { timestamp_ = value; }
189
190 private:
191 Data data_;
192 std::string partition_;
193 porting::optional<int64_t> compressed_data_size_;
194 porting::optional<int64_t> data_size_;
195 porting::optional<int64_t> timestamp_;
196 porting::optional<std::string> checksum_;
197 porting::optional<std::string> data_handle_;
198};
199
203class DATASERVICE_READ_API Message final {
204 public:
210 const Metadata& GetMetaData() const { return meta_data_; }
216 void SetMetaData(Metadata value) { meta_data_ = std::move(value); }
217
223 const StreamOffset& GetOffset() const { return offset_; }
229 void SetOffset(StreamOffset value) { offset_ = std::move(value); }
230
236 const Data& GetData() const { return meta_data_.GetData(); }
237
238 private:
239 Metadata meta_data_;
240 StreamOffset offset_;
241};
242
246class DATASERVICE_READ_API Messages final {
247 public:
253 const std::vector<Message>& GetMessages() const { return messages_; }
259 void SetMessages(std::vector<Message> value) { messages_ = std::move(value); }
260
261 private:
262 std::vector<Message> messages_;
263};
264
265} // namespace model
266} // namespace read
267} // namespace dataservice
268} // namespace olp
Represents a message read from a stream layer.
Definition Messages.h:203
const StreamOffset & GetOffset() const
Gets the offset in a specific partition of the stream layer.
Definition Messages.h:223
const Data & GetData() const
Gets the actual content of this message.
Definition Messages.h:236
void SetMetaData(Metadata value)
Sets the Metadata instance of this message.
Definition Messages.h:216
const Metadata & GetMetaData() const
Gets the Metadata instance of this message.
Definition Messages.h:210
void SetOffset(StreamOffset value)
Sets the StreamOffset instance of this message.
Definition Messages.h:229
Represents a vector of messages consumed from a stream layer.
Definition Messages.h:246
void SetMessages(std::vector< Message > value)
Sets the vector of messages.
Definition Messages.h:259
const std::vector< Message > & GetMessages() const
Gets the vector of messages.
Definition Messages.h:253
Encapsulates information about actual data content.
Definition Messages.h:39
void SetData(Data value)
Sets the data of this content.
Definition Messages.h:141
void SetPartition(std::string value)
Sets the partition ID of this metadata content.
Definition Messages.h:56
void SetChecksum(porting::optional< std::string > value)
(Optional) Sets the checksum of this metadata content.
Definition Messages.h:78
const porting::optional< int64_t > & GetDataSize() const
(Optional) Gets the nominal size (in bytes) of the content.
Definition Messages.h:116
const porting::optional< int64_t > & GetTimestamp() const
(Optional) Get the timestamp of the content.
Definition Messages.h:180
const Data & GetData() const
Gets the data of this Metadata instance.
Definition Messages.h:135
const std::string & GetPartition() const
Gets the partition of this metadata.
Definition Messages.h:50
const porting::optional< int64_t > & GetCompressedDataSize() const
(Optional) Gets the compressed size of the content (in bytes).
Definition Messages.h:91
void SetDataSize(porting::optional< int64_t > value)
(Optional) Sets the nominal size of the content.
Definition Messages.h:124
void SetCompressedDataSize(porting::optional< int64_t > value)
(Optional) Sets the compressed size of the content.
Definition Messages.h:102
void SetDataHandle(porting::optional< std::string > value)
(Optional) Sets the data handle of this content.
Definition Messages.h:168
const porting::optional< std::string > & GetChecksum() const
(Optional) Gets the checksum of this metadata.
Definition Messages.h:68
const porting::optional< std::string > & GetDataHandle() const
(Optional) Gets the data handle created when the content was uploaded.
Definition Messages.h:157
void SetTimestamp(porting::optional< int64_t > value)
(Optional) Sets the timestamp of the content.
Definition Messages.h:188
An offset in a specific partition of a stream layer.
Definition StreamOffsets.h:35
Rules all the other namespaces.
Definition AppleSignInProperties.h:24