olp-cpp-sdk  1.22.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VolatileLayerClient.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 <vector>
24 
25 #include <olp/core/client/ApiError.h>
26 #include <olp/core/client/ApiNoResult.h>
27 #include <olp/core/client/ApiResponse.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/ResponseOkSingle.h>
34 #include <olp/dataservice/write/model/PublishPartitionDataRequest.h>
35 #include <olp/dataservice/write/model/StartBatchRequest.h>
36 #include <olp/dataservice/write/model/VersionResponse.h>
37 
38 namespace olp {
39 namespace client {
40 struct Error;
41 class HRN;
42 } // namespace client
43 
44 namespace dataservice {
45 namespace write {
46 class VolatileLayerClientImpl;
47 
48 using PublishPartitionDataResult =
50 using PublishPartitionDataResponse =
51  client::ApiResponse<PublishPartitionDataResult, client::ApiError>;
52 using PublishPartitionDataCallback =
53  std::function<void(PublishPartitionDataResponse response)>;
54 
55 using GetBaseVersionResult = model::VersionResponse;
56 using GetBaseVersionResponse =
57  client::ApiResponse<GetBaseVersionResult, client::ApiError>;
58 using GetBaseVersionCallback = std::function<void(GetBaseVersionResponse)>;
59 
60 using StartBatchResult = model::Publication;
61 using StartBatchResponse =
62  client::ApiResponse<StartBatchResult, client::ApiError>;
63 using StartBatchCallback = std::function<void(StartBatchResponse)>;
64 
65 using GetBatchResult = model::Publication;
66 using GetBatchResponse = client::ApiResponse<GetBatchResult, client::ApiError>;
67 using GetBatchCallback = std::function<void(GetBatchResponse)>;
68 
69 using PublishToBatchResult = client::ApiNoResult;
70 using PublishToBatchResponse =
71  client::ApiResponse<PublishToBatchResult, client::ApiError>;
72 using PublishToBatchCallback =
73  std::function<void(PublishToBatchResponse response)>;
74 
75 using CompleteBatchResult = client::ApiNoResult;
76 using CompleteBatchResponse =
77  client::ApiResponse<CompleteBatchResult, client::ApiError>;
78 using CompleteBatchCallback =
79  std::function<void(CompleteBatchResponse response)>;
80 
82 class DATASERVICE_WRITE_API VolatileLayerClient {
83  public:
92 
101 
114 
130  PublishPartitionDataCallback callback);
131 
139 
150  GetBaseVersionCallback callback);
151 
160  model::StartBatchRequest request);
161 
173  StartBatchCallback callback);
174 
184  const model::Publication& pub);
185 
197  GetBatchCallback callback);
198 
222  const model::Publication& pub,
223  const std::vector<model::PublishPartitionDataRequest>& partitions);
224 
250  const model::Publication& pub,
251  const std::vector<model::PublishPartitionDataRequest>& partitions,
252  PublishToBatchCallback callback);
253 
262  const model::Publication& pub);
263 
275  CompleteBatchCallback callback);
276 
277  private:
278  std::shared_ptr<VolatileLayerClientImpl> impl_;
279 };
280 
281 } // namespace write
282 } // namespace dataservice
283 } // 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 volatile layer.
Definition: VolatileLayerClient.h:82
VolatileLayerClient(client::HRN catalog, client::OlpClientSettings settings)
Creates the VolatileLayerClient instance.
olp::client::CancellableFuture< PublishPartitionDataResponse > PublishPartitionData(model::PublishPartitionDataRequest request)
Publishes data to the volatile layer.
olp::client::CancellationToken GetBaseVersion(GetBaseVersionCallback callback)
Gets the latest version number of the catalog.
olp::client::CancellableFuture< PublishToBatchResponse > PublishToBatch(const model::Publication &pub, const std::vector< model::PublishPartitionDataRequest > &partitions)
Publishes metadata to the HERE platform.
olp::client::CancellationToken PublishToBatch(const model::Publication &pub, const std::vector< model::PublishPartitionDataRequest > &partitions, PublishToBatchCallback callback)
Publishes metadata to the HERE platform.
olp::client::CancellableFuture< GetBatchResponse > GetBatch(const model::Publication &pub)
Gets the details of the batch publication.
olp::client::CancellationToken PublishPartitionData(model::PublishPartitionDataRequest request, PublishPartitionDataCallback callback)
Publishes data to the volatile layer.
olp::client::CancellationToken StartBatch(model::StartBatchRequest request, StartBatchCallback callback)
Starts the batch operation.
olp::client::CancellationToken CompleteBatch(const model::Publication &pub, CompleteBatchCallback callback)
Completes the batch operation and commits it to the HERE platform.
olp::client::CancellableFuture< CompleteBatchResponse > CompleteBatch(const model::Publication &pub)
Completes the batch operation and commits it to the HERE platform.
olp::client::CancellableFuture< GetBaseVersionResponse > GetBaseVersion()
Gets the latest version number of the catalog.
olp::client::CancellableFuture< StartBatchResponse > StartBatch(model::StartBatchRequest request)
Starts the batch operation.
olp::client::CancellationToken GetBatch(const model::Publication &pub, GetBatchCallback callback)
Gets the details of the batch publication.
void CancelPendingRequests()
Cancels all the ongoing operations that this client started.
Contains information on a publication.
Definition: Publication.h:37
Publishes data to a versioned and volatile layer.
Definition: PublishPartitionDataRequest.h:36
Represents a response to a successful data upload operation to a catalog layer.
Definition: ResponseOkSingle.h:34
Starts a versioned batch operation.
Definition: StartBatchRequest.h:37
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition: OlpClientSettings.h:180