olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
StreamLayerClient.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 <memory>
23#include <string>
24
25#include <olp/core/client/CancellationContext.h>
26#include <olp/core/client/CancellationToken.h>
27#include <olp/core/client/HRN.h>
28#include <olp/core/client/OlpClientSettings.h>
29#include <olp/dataservice/read/DataServiceReadApi.h>
30#include <olp/dataservice/read/SeekRequest.h>
31#include <olp/dataservice/read/SubscribeRequest.h>
32#include <olp/dataservice/read/Types.h>
33#include <olp/dataservice/read/model/Messages.h>
34
35namespace olp {
36namespace dataservice {
37namespace read {
38class StreamLayerClientImpl;
39
96class DATASERVICE_READ_API StreamLayerClient final {
97 public:
107 StreamLayerClient(client::HRN catalog, std::string layer_id,
109
111 StreamLayerClient(const StreamLayerClient& other) = delete;
112
115
118
121
123
130
142 SubscribeResponseCallback callback);
143
154 SubscribeRequest request);
155
164 client::CancellationToken Unsubscribe(UnsubscribeResponseCallback callback);
165
174
191 DataResponseCallback callback);
192
208 const model::Message& message);
209
223 client::CancellationToken Poll(PollResponseCallback callback);
224
237
255 SeekResponseCallback callback);
256
273
274 private:
275 std::unique_ptr<StreamLayerClientImpl> impl_;
276};
277
278} // namespace read
279} // namespace dataservice
280} // namespace olp
A wrapper template that you can use to cancel a request or wait for it to finalize.
Definition ApiResponse.h:281
Cancels service requests.
Definition CancellationToken.h:33
Allows a Here Resource Name (HRN) to be passed to the operations that require it.
Definition HRN.h:34
Requests to seek an offset for a stream layer.
Definition SeekRequest.h:34
Provides the ability to consume data from a stream layer in real time.
Definition StreamLayerClient.h:96
client::CancellableFuture< DataResponse > GetData(const model::Message &message)
Downloads message data using a data handle from the given message metadata.
StreamLayerClient(StreamLayerClient &&other) noexcept
A default move constructor.
StreamLayerClient & operator=(const StreamLayerClient &other)=delete
A copy assignment operator.
StreamLayerClient(client::HRN catalog, std::string layer_id, client::OlpClientSettings settings)
Creates the StreamLayerClient instance.
client::CancellableFuture< SubscribeResponse > Subscribe(SubscribeRequest request)
Enables message consumption for the specific stream layer.
client::CancellationToken Subscribe(SubscribeRequest request, SubscribeResponseCallback callback)
Enables message consumption for the specific stream layer.
bool CancelPendingRequests()
Cancels all the active and pending requests.
client::CancellationToken Poll(PollResponseCallback callback)
Reads messages from a stream layer and commits successfully consumed messages before returning them t...
client::CancellationToken GetData(const model::Message &message, DataResponseCallback callback)
Downloads the message data using the data handle from the given message metadata.
StreamLayerClient(const StreamLayerClient &other)=delete
A copy constructor.
StreamLayerClient & operator=(StreamLayerClient &&other) noexcept
A move assignment operator.
client::CancellationToken Seek(SeekRequest request, SeekResponseCallback callback)
Allows changing the data stream reading offset.
client::CancellableFuture< SeekResponse > Seek(SeekRequest request)
Allows changing the data stream reading offset.
client::CancellableFuture< UnsubscribeResponse > Unsubscribe()
Deletes the current subscription for the stream layer.
client::CancellableFuture< PollResponse > Poll()
Reads messages from a stream layer and commits successfully consumed messages before returning them t...
client::CancellationToken Unsubscribe(UnsubscribeResponseCallback callback)
Deletes the current subscription for the stream layer.
Used to subscribe to a stream layer.
Definition SubscribeRequest.h:36
Represents a message read from a stream layer.
Definition Messages.h:203
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition OlpClientSettings.h:178