olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
VersionedLayerClient.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
24#include <olp/core/client/ApiError.h>
25#include <olp/core/client/ApiNoResult.h>
26#include <olp/core/client/ApiResponse.h>
27#include <olp/core/client/HRN.h>
28#include <olp/core/client/OlpClientSettings.h>
29#include <olp/core/porting/deprecated.h>
30
31#include <olp/dataservice/write/DataServiceWriteApi.h>
32#include <olp/dataservice/write/generated/model/Publication.h>
33#include <olp/dataservice/write/generated/model/ResponseOk.h>
34#include <olp/dataservice/write/generated/model/ResponseOkSingle.h>
35#include <olp/dataservice/write/model/CheckDataExistsRequest.h>
36#include <olp/dataservice/write/model/PublishPartitionDataRequest.h>
37#include <olp/dataservice/write/model/StartBatchRequest.h>
38#include <olp/dataservice/write/model/VersionResponse.h>
39
40namespace olp {
41namespace dataservice {
42namespace write {
43
44using StartBatchResult = model::Publication;
45using StartBatchResponse =
46 client::ApiResponse<StartBatchResult, client::ApiError>;
47using StartBatchCallback = std::function<void(StartBatchResponse)>;
48
49using GetBaseVersionResult = model::VersionResponse;
50using GetBaseVersionResponse =
51 client::ApiResponse<GetBaseVersionResult, client::ApiError>;
52using GetBaseVersionCallback = std::function<void(GetBaseVersionResponse)>;
53
54using GetBatchResult = model::Publication;
55using GetBatchResponse = client::ApiResponse<GetBatchResult, client::ApiError>;
56using GetBatchCallback = std::function<void(GetBatchResponse)>;
57
58using CompleteBatchResult = client::ApiNoResult;
59using CompleteBatchResponse =
60 client::ApiResponse<CompleteBatchResult, client::ApiError>;
61using CompleteBatchCallback =
62 std::function<void(CompleteBatchResponse response)>;
63
64using CancelBatchResult = client::ApiNoResult;
65using CancelBatchResponse =
66 client::ApiResponse<CancelBatchResult, client::ApiError>;
67using CancelBatchCallback = std::function<void(CancelBatchResponse response)>;
68
69using PublishPartitionDataResponse =
70 client::ApiResponse<model::ResponseOkSingle, client::ApiError>;
71using PublishPartitionDataCallback =
72 std::function<void(PublishPartitionDataResponse response)>;
73
74using CheckDataExistsStatusCode = int;
75using CheckDataExistsResponse =
76 client::ApiResponse<CheckDataExistsStatusCode, client::ApiError>;
77using CheckDataExistsCallback =
78 std::function<void(CheckDataExistsResponse response)>;
79
80class VersionedLayerClientImpl;
81
83class DATASERVICE_WRITE_API VersionedLayerClient {
84 public:
93
103
115 StartBatchCallback callback);
116
124
135 GetBaseVersionCallback callback);
136
146 const model::Publication& pub);
147
159 GetBatchCallback callback);
160
169 const model::Publication& pub);
170
182 CompleteBatchCallback callback);
183
192 const model::Publication& pub);
193
205 CancelBatchCallback callback);
206
215
228 const model::Publication& pub,
230
247 PublishPartitionDataCallback callback);
248
258
270 model::CheckDataExistsRequest request, CheckDataExistsCallback callback);
271
272 private:
273 std::shared_ptr<VersionedLayerClientImpl> impl_;
274};
275
276} // namespace write
277} // namespace dataservice
278} // 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 versioned layers.
Definition VersionedLayerClient.h:83
olp::client::CancellableFuture< CheckDataExistsResponse > CheckDataExists(model::CheckDataExistsRequest request)
Checks whether the data handle exits.
olp::client::CancellableFuture< CompleteBatchResponse > CompleteBatch(const model::Publication &pub)
Completes the batch operation and commits it to the HERE platform.
olp::client::CancellationToken GetBatch(const model::Publication &pub, GetBatchCallback callback)
Gets the details of the batch publication.
olp::client::CancellableFuture< GetBaseVersionResponse > GetBaseVersion()
Gets the latest version number of the catalog.
olp::client::CancellableFuture< GetBatchResponse > GetBatch(const model::Publication &pub)
Gets the details of the batch publication.
olp::client::CancellableFuture< PublishPartitionDataResponse > PublishToBatch(const model::Publication &pub, model::PublishPartitionDataRequest request)
Publishes data to the versioned layer.
olp::client::CancellationToken CancelBatch(const model::Publication &pub, CancelBatchCallback callback)
Cancels the batch operation.
VersionedLayerClient(client::HRN catalog, client::OlpClientSettings settings)
Creates the VersionedLayerClient instance.
olp::client::CancellationToken PublishToBatch(const model::Publication &pub, model::PublishPartitionDataRequest request, PublishPartitionDataCallback callback)
Publishes data to the versioned layer.
olp::client::CancellationToken GetBaseVersion(GetBaseVersionCallback callback)
Gets the latest version number of the catalog.
olp::client::CancellationToken StartBatch(model::StartBatchRequest request, StartBatchCallback callback)
Starts the batch operation.
olp::client::CancellableFuture< StartBatchResponse > StartBatch(model::StartBatchRequest request)
Starts the batch operation.
void CancelPendingRequests()
Cancels all the ongoing operations that this client started.
olp::client::CancellationToken CheckDataExists(model::CheckDataExistsRequest request, CheckDataExistsCallback callback)
Checks whether the data handle exits.
olp::client::CancellableFuture< CancelBatchResponse > CancelBatch(const model::Publication &pub)
Cancels the batch operation.
olp::client::CancellationToken CompleteBatch(const model::Publication &pub, CompleteBatchCallback callback)
Completes the batch operation and commits it to the HERE platform.
Checks whether data is present in a layer.
Definition CheckDataExistsRequest.h:34
Contains information on a publication.
Definition Publication.h:36
Publishes data to a versioned and volatile layer.
Definition PublishPartitionDataRequest.h:35
Starts a versioned batch operation.
Definition StartBatchRequest.h:36
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition OlpClientSettings.h:178