olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
StreamLayerClient.h
1/*
2 * Copyright (C) 2019-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#include <vector>
25
26#include <olp/core/client/ApiError.h>
27#include <olp/core/client/ApiResponse.h>
28#include <olp/core/client/OlpClientSettings.h>
29#include <olp/core/porting/deprecated.h>
30#include <olp/dataservice/write/DataServiceWriteApi.h>
31#include <olp/dataservice/write/StreamLayerClientSettings.h>
32#include <olp/dataservice/write/generated/model/ResponseOk.h>
33#include <olp/dataservice/write/generated/model/ResponseOkSingle.h>
34#include <olp/dataservice/write/model/FlushRequest.h>
35#include <olp/dataservice/write/model/PublishDataRequest.h>
36#include <olp/dataservice/write/model/PublishSdiiRequest.h>
37
38namespace olp {
39namespace client {
40struct Error;
41class HRN;
42} // namespace client
43
44namespace dataservice {
45namespace write {
46class StreamLayerClientImpl;
47
49using PublishDataResponse =
50 client::ApiResponse<PublishDataResult, client::ApiError>;
51using PublishDataCallback = std::function<void(PublishDataResponse response)>;
52
53using PublishSdiiResult = olp::dataservice::write::model::ResponseOk;
54using PublishSdiiResponse =
55 client::ApiResponse<PublishSdiiResult, client::ApiError>;
56using PublishSdiiCallback = std::function<void(PublishSdiiResponse response)>;
57
59class DATASERVICE_WRITE_API StreamLayerClient {
60 public:
62 using FlushResponse = std::vector<PublishDataResponse>;
63
65 using FlushCallback = std::function<void(FlushResponse response)>;
66
78 StreamLayerClientSettings client_settings,
80
92
105
120 PublishDataCallback callback);
121
130 porting::optional<std::string> Queue(model::PublishDataRequest request);
131
140 model::FlushRequest request);
141
153 FlushCallback callback);
154
169
186 PublishSdiiCallback callback);
187
188 private:
189 std::shared_ptr<StreamLayerClientImpl> impl_;
190};
191
192} // namespace write
193} // namespace dataservice
194} // 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
Publishes data to a stream layer.
Definition StreamLayerClient.h:59
olp::client::CancellationToken PublishSdii(model::PublishSdiiRequest request, PublishSdiiCallback callback)
Sends a list of SDII messages to a stream layer.
olp::client::CancellableFuture< PublishSdiiResponse > PublishSdii(model::PublishSdiiRequest request)
Sends a list of SDII messages to a stream layer.
void CancelPendingRequests()
Cancels all the ongoing publish operations that this client started.
olp::client::CancellableFuture< PublishDataResponse > PublishData(model::PublishDataRequest request)
Publishes data to the stream layer.
std::vector< PublishDataResponse > FlushResponse
An alias for the flush response.
Definition StreamLayerClient.h:62
olp::client::CancellationToken Flush(model::FlushRequest request, FlushCallback callback)
Flushes PublishDataRequests that are queued via the Queue API.
olp::client::CancellableFuture< FlushResponse > Flush(model::FlushRequest request)
Flushes PublishDataRequests that are queued via the Queue API.
std::function< void(FlushResponse response)> FlushCallback
An alias for the flush callback.
Definition StreamLayerClient.h:65
porting::optional< std::string > Queue(model::PublishDataRequest request)
Enqueues PublishDataRequest that is sent over the wire.
olp::client::CancellationToken PublishData(model::PublishDataRequest request, PublishDataCallback callback)
Publishes data to the stream layer.
StreamLayerClient(client::HRN catalog, StreamLayerClientSettings client_settings, client::OlpClientSettings settings)
Creates the StreamLayerClient insatnce.
Flushes requests in a stream layer.
Definition FlushRequest.h:29
Publishes data to a stream layer.
Definition PublishDataRequest.h:35
Sends a list of SDII messages to a stream layer.
Definition PublishSdiiRequest.h:44
Represents a response to a successful data upload operation to a catalog layer.
Definition ResponseOkSingle.h:34
Contians a response to a successful ingestSDII call.
Definition ResponseOk.h:113
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition OlpClientSettings.h:178
Configures the behavior of the StreamLayerClient specific logic.
Definition StreamLayerClientSettings.h:32