Gets data from a volatile layer of the HERE platform.
More...
#include <VolatileLayerClient.h>
Gets data from a volatile layer of the HERE platform.
The volatile layer is a key/value store. Values for a given key can change, and only the latest value is retrievable. Therefore, you can only get the latest published data from the volatile layer.
Example:
auto task_scheduler =
settings.network_request_handler = http_client;
auth_settings.provider =
client_settings.authentication_settings = auth_settings;
client_settings.task_scheduler = std::move(task_scheduler);
client_settings.network_request_handler = std::move(http_client);
VolatileLayerClient client{
"hrn:here:data:::your-catalog-hrn",
"your-layer-id", client_settings};
auto request = DataRequest().WithPartitionId("269");
auto token = client.GetData(request, callback);
Represents a request outcome.
Definition: ApiResponse.h:65
static std::shared_ptr< http::Network > CreateDefaultNetworkRequestHandler(size_t max_requests_count=30u)
Creates the Network instance used for all the non-local requests.
static std::unique_ptr< thread::TaskScheduler > CreateDefaultTaskScheduler(size_t thread_count=1u)
Creates the TaskScheduler instance used for all the delayed operations.
VolatileLayerClient(client::HRN catalog, std::string layer_id, client::OlpClientSettings settings)
Creates the VolatileLayerClient instance.
TokenProvider< kDefaultMinimumValidity > TokenProviderDefault
Definition: TokenProvider.h:163
Configures the TokenEndpoint instance.
Definition: Settings.h:50
std::shared_ptr< thread::TaskScheduler > task_scheduler
(Optional) The TaskScheduler class that is used to manage the callbacks enqueue.
Definition: Settings.h:75
A set of settings that manages the TokenProviderCallback and TokenProviderCancelCallback functions.
Definition: OlpClientSettings.h:75
Configures the behavior of the OlpClient class.
Definition: OlpClientSettings.h:180
- See also
- The volatile layer section in the Data User Guide.
◆ VolatileLayerClient()
Creates the VolatileLayerClient
instance.
- Parameters
-
catalog | The HERE Resource Name (HRN) of the catalog that contains the volatile layer from which you want to get data. |
layer_id | The layer ID of the volatile layer from which you want to get data. |
settings | The OlpClientSettings instance. |
◆ CancelPendingRequests()
bool olp::dataservice::read::VolatileLayerClient::CancelPendingRequests |
( |
| ) |
|
Cancels all active and pending requests.
- Returns
- True if the request is successful; false otherwise.
◆ DeleteFromCache() [1/2]
Removes the tile from the mutable disk cache.
- Parameters
-
tile | The tile key that should be removed. |
- Returns
- An error if the tile data could not be removed from the cache.
◆ DeleteFromCache() [2/2]
client::ApiNoResponse olp::dataservice::read::VolatileLayerClient::DeleteFromCache |
( |
const std::string & |
partition_id | ) |
|
Removes the partition from the mutable disk cache.
- Parameters
-
partition_id | The partition ID that should be removed. |
- Returns
- An error if the partition data could not be removed from the cache.
◆ GetData() [1/2]
Fetches data asynchronously using a partition ID or data handle.
If the specified partition or data handle cannot be found in the layer, the callback is invoked with the empty DataResponse
object (the nullptr
result and an error). If a partition ID or data handle is not set in the request, the callback is invoked with the following error: ErrorCode::InvalidRequest
.
- Parameters
-
request | The DataRequest instance that contains a complete set of the request parameters. |
- Returns
CancellableFuture
that contains the DataResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request.
◆ GetData() [2/2]
Fetches data asynchronously using a partition ID or data handle.
If the specified partition or data handle cannot be found in the layer, the callback is invoked with the empty DataResponse
object (the nullptr
result and an error). If a partition ID or data handle is not set in the request, the callback is invoked with the following error: ErrorCode::InvalidRequest
.
- Parameters
-
request | The DataRequest instance that contains a complete set of request parameters. |
callback | The DataResponseCallback object that is invoked if the DataResult object is available or an error is encountered. |
- Returns
- A token that can be used to cancel this request.
◆ GetPartitions() [1/2]
Fetches a list of volatile layer partitions asynchronously.
- Note
- If your layer has lots of partitions or uses tile keys as partition IDs, then this operation can fail because of the large amount of data.
- Parameters
-
request | The PartitionsRequest instance that contains a complete set of request parameters. |
- Returns
CancellableFuture
that contains the PartitionsResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request.
◆ GetPartitions() [2/2]
Fetches a list of volatile layer partitions asynchronously.
- Note
- If your layer has lots of partitions or uses tile keys as partition IDs, then this operation can fail because of the large amount of data.
- Parameters
-
request | The PartitionsRequest instance that contains a complete set of request parameters. |
callback | The PartitionsResponseCallback object that is invoked if the list of partitions is available or an error is encountered. |
- Returns
- A token that can be used to cancel this request.
◆ PrefetchTiles() [1/2]
Prefetches a set of tiles asynchronously.
This method recursively downloads all tile keys from the min_level
parameter to the max_level
parameter of the PrefetchTilesRequest
object for the given root tiles. If min_level/max_level are default, only tiles listed in PrefetchTilesRequest
will be downloaded. Only tiles will be downloaded which are not already present in the cache, this helps reduce the network load.
- Note
- This method does not guarantee that all tiles are available offline as the cache might overflow, and data might be evicted at any point.
- Parameters
-
- Returns
CancellableFuture
that contains the PrefetchTilesResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request.
◆ PrefetchTiles() [2/2]
Prefetches a set of tiles asynchronously.
This method recursively downloads all tile keys from the min_level
parameter to the max_level
parameter of the PrefetchTilesRequest
object for the given root tiles. If min_level/max_level are default, only tiles listed in PrefetchTilesRequest
will be downloaded. Only tiles will be downloaded which are not already present in the cache, this helps reduce the network load.
- Note
- This method does not guarantee that all tiles are available offline as the cache might overflow, and data might be evicted at any point.
- Parameters
-
request | The PrefetchTilesRequest instance that contains a complete set of request parameters. |
callback | The PrefetchTilesResponseCallback object that is invoked if the PrefetchTilesResult instance is available or an error is encountered. |
- Returns
- A token that can be used to cancel this request.
◆ RemoveFromCache() [1/2]
bool olp::dataservice::read::VolatileLayerClient::RemoveFromCache |
( |
const geo::TileKey & |
tile | ) |
|
Removes the tile from the mutable disk cache.
- Parameters
-
tile | The tile key that should be removed. |
- Returns
- True if tile data is removed successfully; false otherwise.
◆ RemoveFromCache() [2/2]
bool olp::dataservice::read::VolatileLayerClient::RemoveFromCache |
( |
const std::string & |
partition_id | ) |
|
Removes the partition from the mutable disk cache.
- Parameters
-
partition_id | The partition ID that should be removed. |
- Returns
- True if partition data is removed successfully; false otherwise.
The documentation for this class was generated from the following file: