olp-cpp-sdk  1.22.0
VolatileLayerClient.h
1 /*
2  * Copyright (C) 2019-2024 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/ApiError.h>
26 #include <olp/core/client/ApiResponse.h>
27 #include <olp/core/client/CancellationToken.h>
28 #include <olp/core/client/HRN.h>
29 #include <olp/core/client/OlpClientSettings.h>
30 #include <olp/core/geo/tiling/TileKey.h>
31 #include <olp/dataservice/read/DataRequest.h>
32 #include <olp/dataservice/read/PartitionsRequest.h>
33 #include <olp/dataservice/read/PrefetchTilesRequest.h>
34 #include <olp/dataservice/read/Types.h>
35 
36 namespace olp {
37 namespace dataservice {
38 namespace read {
39 class VolatileLayerClientImpl;
40 
41 // clang-format off
80 // clang-format on
81 class DATASERVICE_READ_API VolatileLayerClient final {
82  public:
92  VolatileLayerClient(client::HRN catalog, std::string layer_id,
93  client::OlpClientSettings settings);
94 
96  VolatileLayerClient(const VolatileLayerClient& other) = delete;
97 
100 
103 
106 
108 
115 
131  PartitionsResponseCallback callback);
132 
148  PartitionsRequest request);
149 
167  DataResponseCallback callback);
168 
186 
194  bool RemoveFromCache(const std::string& partition_id);
195 
203  bool RemoveFromCache(const geo::TileKey& tile);
204 
212  client::ApiNoResponse DeleteFromCache(const std::string& partition_id);
213 
222 
245  PrefetchTilesRequest request, PrefetchTilesResponseCallback callback);
246 
268  PrefetchTilesRequest request);
269 
270  private:
271  std::unique_ptr<VolatileLayerClientImpl> impl_;
272 };
273 
274 } // namespace read
275 } // namespace dataservice
276 } // namespace olp
Represents a request outcome.
Definition: ApiResponse.h:65
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
Encapsulates the fields required to request data for the given catalog, layer, and partition.
Definition: DataRequest.h:43
Encapsulates the fields required to request a list of partitions for the given catalog and layer.
Definition: PartitionsRequest.h:40
Encapsulates the fields required to prefetch the specified layers, tiles, and levels.
Definition: PrefetchTilesRequest.h:47
Gets data from a volatile layer of the HERE platform.
Definition: VolatileLayerClient.h:81
bool RemoveFromCache(const std::string &partition_id)
Removes the partition from the mutable disk cache.
VolatileLayerClient(VolatileLayerClient &&other) noexcept
A default move constructor.
client::ApiNoResponse DeleteFromCache(const std::string &partition_id)
Removes the partition from the mutable disk cache.
VolatileLayerClient(const VolatileLayerClient &other)=delete
A copy constructor.
bool CancelPendingRequests()
Cancels all active and pending requests.
olp::client::CancellableFuture< DataResponse > GetData(DataRequest request)
Fetches data asynchronously using a partition ID or data handle.
olp::client::CancellableFuture< PartitionsResponse > GetPartitions(PartitionsRequest request)
Fetches a list of volatile layer partitions asynchronously.
VolatileLayerClient & operator=(VolatileLayerClient &&other) noexcept
A move assignment operator.
client::CancellationToken GetPartitions(PartitionsRequest request, PartitionsResponseCallback callback)
Fetches a list of volatile layer partitions asynchronously.
olp::client::CancellationToken GetData(DataRequest request, DataResponseCallback callback)
Fetches data asynchronously using a partition ID or data handle.
VolatileLayerClient(client::HRN catalog, std::string layer_id, client::OlpClientSettings settings)
Creates the VolatileLayerClient instance.
client::CancellationToken PrefetchTiles(PrefetchTilesRequest request, PrefetchTilesResponseCallback callback)
Prefetches a set of tiles asynchronously.
client::ApiNoResponse DeleteFromCache(const geo::TileKey &tile)
Removes the tile from the mutable disk cache.
bool RemoveFromCache(const geo::TileKey &tile)
Removes the tile from the mutable disk cache.
VolatileLayerClient & operator=(const VolatileLayerClient &other)=delete
A copy assignment operator.
client::CancellableFuture< PrefetchTilesResponse > PrefetchTiles(PrefetchTilesRequest request)
Prefetches a set of tiles asynchronously.
Addresses a tile in a quadtree.
Definition: TileKey.h:63
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24
Configures the behavior of the OlpClient class.
Definition: OlpClientSettings.h:180