olp-cpp-sdk  1.22.0
Public Member Functions | List of all members
olp::dataservice::read::VolatileLayerClient Class Referencefinal

Gets data from a volatile layer of the HERE platform. More...

#include <VolatileLayerClient.h>

Public Member Functions

 VolatileLayerClient (client::HRN catalog, std::string layer_id, client::OlpClientSettings settings)
 Creates the VolatileLayerClient instance. More...
 
 VolatileLayerClient (const VolatileLayerClient &other)=delete
 A copy constructor.
 
 VolatileLayerClient (VolatileLayerClient &&other) noexcept
 A default move constructor.
 
VolatileLayerClientoperator= (const VolatileLayerClient &other)=delete
 A copy assignment operator.
 
VolatileLayerClientoperator= (VolatileLayerClient &&other) noexcept
 A move assignment operator.
 
bool CancelPendingRequests ()
 Cancels all active and pending requests. More...
 
client::CancellationToken GetPartitions (PartitionsRequest request, PartitionsResponseCallback callback)
 Fetches a list of volatile layer partitions asynchronously. More...
 
olp::client::CancellableFuture< PartitionsResponseGetPartitions (PartitionsRequest request)
 Fetches a list of volatile layer partitions asynchronously. More...
 
olp::client::CancellationToken GetData (DataRequest request, DataResponseCallback callback)
 Fetches data asynchronously using a partition ID or data handle. More...
 
olp::client::CancellableFuture< DataResponseGetData (DataRequest request)
 Fetches data asynchronously using a partition ID or data handle. More...
 
bool RemoveFromCache (const std::string &partition_id)
 Removes the partition from the mutable disk cache. More...
 
bool RemoveFromCache (const geo::TileKey &tile)
 Removes the tile from the mutable disk cache. More...
 
client::ApiNoResponse DeleteFromCache (const std::string &partition_id)
 Removes the partition from the mutable disk cache. More...
 
client::ApiNoResponse DeleteFromCache (const geo::TileKey &tile)
 Removes the tile from the mutable disk cache. More...
 
client::CancellationToken PrefetchTiles (PrefetchTilesRequest request, PrefetchTilesResponseCallback callback)
 Prefetches a set of tiles asynchronously. More...
 
client::CancellableFuture< PrefetchTilesResponsePrefetchTiles (PrefetchTilesRequest request)
 Prefetches a set of tiles asynchronously. More...
 

Detailed Description

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 =
auto http_client = olp::client::
olp::authentication::Settings settings{"Your.Key.Id", "Your.Key.Secret"};
settings.task_scheduler = task_scheduler;
settings.network_request_handler = http_client;
auth_settings.provider =
auto client_settings = olp::client::OlpClientSettings();
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.

Constructor & Destructor Documentation

◆ VolatileLayerClient()

olp::dataservice::read::VolatileLayerClient::VolatileLayerClient ( client::HRN  catalog,
std::string  layer_id,
client::OlpClientSettings  settings 
)

Creates the VolatileLayerClient instance.

Parameters
catalogThe HERE Resource Name (HRN) of the catalog that contains the volatile layer from which you want to get data.
layer_idThe layer ID of the volatile layer from which you want to get data.
settingsThe OlpClientSettings instance.

Member Function Documentation

◆ 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]

client::ApiNoResponse olp::dataservice::read::VolatileLayerClient::DeleteFromCache ( const geo::TileKey tile)

Removes the tile from the mutable disk cache.

Parameters
tileThe 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_idThe partition ID that should be removed.
Returns
An error if the partition data could not be removed from the cache.

◆ GetData() [1/2]

olp::client::CancellableFuture<DataResponse> olp::dataservice::read::VolatileLayerClient::GetData ( DataRequest  request)

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
requestThe 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]

olp::client::CancellationToken olp::dataservice::read::VolatileLayerClient::GetData ( DataRequest  request,
DataResponseCallback  callback 
)

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
requestThe DataRequest instance that contains a complete set of request parameters.
callbackThe 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]

olp::client::CancellableFuture<PartitionsResponse> olp::dataservice::read::VolatileLayerClient::GetPartitions ( PartitionsRequest  request)

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
requestThe 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]

client::CancellationToken olp::dataservice::read::VolatileLayerClient::GetPartitions ( PartitionsRequest  request,
PartitionsResponseCallback  callback 
)

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
requestThe PartitionsRequest instance that contains a complete set of request parameters.
callbackThe 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]

client::CancellableFuture<PrefetchTilesResponse> olp::dataservice::read::VolatileLayerClient::PrefetchTiles ( PrefetchTilesRequest  request)

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
requestThe PrefetchTilesRequest instance that contains a complete set of request 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]

client::CancellationToken olp::dataservice::read::VolatileLayerClient::PrefetchTiles ( PrefetchTilesRequest  request,
PrefetchTilesResponseCallback  callback 
)

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
requestThe PrefetchTilesRequest instance that contains a complete set of request parameters.
callbackThe 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
tileThe 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_idThe 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: