olp-cpp-sdk
1.22.0
|
Gets data from a versioned layer of the HERE platform. More...
#include <VersionedLayerClient.h>
Public Member Functions | |
VersionedLayerClient (client::HRN catalog, std::string layer_id, boost::optional< int64_t > catalog_version, client::OlpClientSettings settings) | |
Creates the VersionedLayerClient instance with the specified catalog version. More... | |
VersionedLayerClient (const VersionedLayerClient &other)=delete | |
A copy constructor. | |
VersionedLayerClient (VersionedLayerClient &&other) noexcept | |
A default move constructor. | |
VersionedLayerClient & | operator= (const VersionedLayerClient &other)=delete |
A copy assignment operator. | |
VersionedLayerClient & | operator= (VersionedLayerClient &&other) noexcept |
A move assignment operator. | |
bool | CancelPendingRequests () |
Cancels all active and pending requests. More... | |
client::CancellationToken | GetData (DataRequest data_request, DataResponseCallback callback) |
Fetches data asynchronously using a partition ID or data handle. More... | |
client::CancellableFuture< DataResponse > | GetData (DataRequest data_request) |
Fetches data asynchronously using a partition ID or data handle. More... | |
client::CancellationToken | GetData (TileRequest request, DataResponseCallback callback) |
Fetches data asynchronously using a TileKey. More... | |
client::CancellableFuture< DataResponse > | GetData (TileRequest request) |
Fetches data asynchronously using a TileKey. More... | |
client::CancellationToken | GetAggregatedData (TileRequest request, AggregatedDataResponseCallback callback) |
Fetches data of a tile or its closest ancestor. More... | |
client::CancellableFuture< AggregatedDataResponse > | GetAggregatedData (TileRequest request) |
Fetches data of a tile or its closest ancestor. More... | |
client::CancellationToken | GetPartitions (PartitionsRequest partitions_request, PartitionsResponseCallback callback) |
Fetches a list of partitions of the given generic layer asynchronously. More... | |
client::CancellationToken | StreamLayerPartitions (PartitionsRequest partitions_request, PartitionsStreamCallback partition_stream_callback, CallbackNoResult callback) |
Fetches a list of partitions of the given generic layer asynchronously. Client does not cache the partitions, instead every partition is passed to the provided callback. More... | |
client::CancellableFuture< PartitionsResponse > | GetPartitions (PartitionsRequest partitions_request) |
Fetches a list of partitions of the given generic layer asynchronously. More... | |
client::CancellationToken | QuadTreeIndex (TileRequest tile_request, PartitionsResponseCallback callback) |
Fetches a list of partitions including data size, checksum and crc asynchronously. More... | |
client::CancellationToken | PrefetchTiles (PrefetchTilesRequest request, PrefetchTilesResponseCallback callback, PrefetchStatusCallback status_callback=nullptr) |
Prefetches a set of tiles asynchronously. More... | |
client::CancellableFuture< PrefetchTilesResponse > | PrefetchTiles (PrefetchTilesRequest request, PrefetchStatusCallback status_callback=nullptr) |
Prefetches a set of tiles asynchronously. More... | |
client::CancellationToken | PrefetchPartitions (PrefetchPartitionsRequest request, PrefetchPartitionsResponseCallback callback, PrefetchPartitionsStatusCallback status_callback=nullptr) |
Prefetches a set of partitions asynchronously. More... | |
client::CancellableFuture< PrefetchPartitionsResponse > | PrefetchPartitions (PrefetchPartitionsRequest request, PrefetchPartitionsStatusCallback status_callback=nullptr) |
Prefetches a set of partitions asynchronously. 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... | |
bool | IsCached (const std::string &partition_id) const |
Checks whether the partition is cached. More... | |
bool | IsCached (const geo::TileKey &tile, bool aggregated=false) const |
Checks whether the tile is cached. More... | |
bool | Protect (const TileKeys &tiles) |
Protects tile keys from eviction. More... | |
bool | Protect (const std::string &partition_id) |
Protect partition from eviction. More... | |
bool | Protect (const std::vector< std::string > &partition_ids) |
Protect partitions from eviction. More... | |
bool | Release (const TileKeys &tiles) |
Removes a list of tiles from protection. More... | |
bool | Release (const std::string &partition_id) |
Removes partition from protection. More... | |
bool | Release (const std::vector< std::string > &partition_ids) |
Removes partitions from protection. More... | |
Gets data from a versioned layer of the HERE platform.
The versioned layer stores slowly-changing data that must remain logically consistent with other layers in a catalog. You can request any data version from the versioned layer. When you request a particular version of data from the versioned layer, the partition you receive in the response may have a lower version number than you requested. The version of a layer or partition represents the catalog version in which the layer or partition was last updated.
An example with the catalog version provided that saves one network request:
olp::dataservice::read::VersionedLayerClient::VersionedLayerClient | ( | client::HRN | catalog, |
std::string | layer_id, | ||
boost::optional< int64_t > | catalog_version, | ||
client::OlpClientSettings | settings | ||
) |
Creates the VersionedLayerClient
instance with the specified catalog version.
The instance of this client is locked to the specified catalog version passed to the constructor and can't be changed. This way we assure data consistency. Keep in mind that catalog version provided with requests like DataRequest, PartitionsRequest, and PrefetchTilesRequest will be ignored.
catalog | The HERE Resource Name (HRN) of the catalog that contains the versioned layer from which you want to get data. |
layer_id | The layer ID of the versioned layer from which you want to get data. |
catalog_version | The version of the catalog from which you want to get data. If no version is specified, the last available version is used instead. |
settings | The OlpClientSettings instance. |
VersionedLayerClient
instance with the specified catalog version. bool olp::dataservice::read::VersionedLayerClient::CancelPendingRequests | ( | ) |
Cancels all active and pending requests.
client::ApiNoResponse olp::dataservice::read::VersionedLayerClient::DeleteFromCache | ( | const geo::TileKey & | tile | ) |
Removes the tile from the mutable disk cache.
tile | The tile key that should be removed. |
client::ApiNoResponse olp::dataservice::read::VersionedLayerClient::DeleteFromCache | ( | const std::string & | partition_id | ) |
Removes the partition from the mutable disk cache.
partition_id | The partition ID that should be removed. |
client::CancellableFuture<AggregatedDataResponse> olp::dataservice::read::VersionedLayerClient::GetAggregatedData | ( | TileRequest | request | ) |
Fetches data of a tile or its closest ancestor.
request | The TileRequest instance that contains a complete set of request parameters. |
CancellableFuture
that contains the AggregatedDataResponse
instance or an error. You can also use CancellableFuture
to cancel this request. client::CancellationToken olp::dataservice::read::VersionedLayerClient::GetAggregatedData | ( | TileRequest | request, |
AggregatedDataResponseCallback | callback | ||
) |
Fetches data of a tile or its closest ancestor.
request | The TileRequest instance that contains a complete set of request parameters. |
callback | The AggregatedDataResponseCallback object that is invoked if the AggregatedDataResult object is available or an error is encountered. |
client::CancellableFuture<DataResponse> olp::dataservice::read::VersionedLayerClient::GetData | ( | DataRequest | data_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
.
data_request | The DataRequest instance that contains a complete set of request parameters. |
CancellableFuture
that contains the DataResponse
instance or an error. You can also use CancellableFuture
to cancel this request. client::CancellationToken olp::dataservice::read::VersionedLayerClient::GetData | ( | DataRequest | data_request, |
DataResponseCallback | callback | ||
) |
Fetches data asynchronously using a partition ID or data handle.
If the specified partition ID 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
. If the version is not specified, an additional request to the HERE platform is created to retrieve the latest available partition version.
data_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. |
client::CancellableFuture<DataResponse> olp::dataservice::read::VersionedLayerClient::GetData | ( | TileRequest | request | ) |
Fetches data asynchronously using a TileKey.
If the specified TileKey cannot be found in the layer, the callback is invoked with the empty DataResponse
object (the nullptr
result and an error). Version for request used from VersionedLayerClient constructor parameter. If no version is specified, the last available version is used instead.GetData(TileRequest) method optimizes the metadata query by requesting a QuadTree with depth 4 and store all subquads in cache. This way all further GetData(TileRequest) request that are contained within this QuadTree will profit from the already cached metadata.
request | The TileRequest instance that contains a complete set of request parameters. |
CancellableFuture
that contains the DataResponse
instance or an error. You can also use CancellableFuture
to cancel this request. client::CancellationToken olp::dataservice::read::VersionedLayerClient::GetData | ( | TileRequest | request, |
DataResponseCallback | callback | ||
) |
Fetches data asynchronously using a TileKey.
If the specified TileKey cannot be found in the layer, the callback is invoked with the empty DataResponse
object (the nullptr
result and an error). Version for request used from VersionedLayerClient constructor parameter. If no version is specified, the last available version is used instead. GetData(TileRequest) method optimizes the metadata query by requesting a QuadTree with depth 4 and store all subquads in cache. This way all further GetData(TileRequest) request that are contained within this QuadTree will profit from the already cached metadata.
request | The TileRequest 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. |
client::CancellableFuture<PartitionsResponse> olp::dataservice::read::VersionedLayerClient::GetPartitions | ( | PartitionsRequest | partitions_request | ) |
Fetches a list of partitions of the given generic layer asynchronously.
partitions_request | The PartitionsRequest instance that contains a complete set of request parameters. |
CancellableFuture
that contains the PartitionsResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request. client::CancellationToken olp::dataservice::read::VersionedLayerClient::GetPartitions | ( | PartitionsRequest | partitions_request, |
PartitionsResponseCallback | callback | ||
) |
Fetches a list of partitions of the given generic layer asynchronously.
partitions_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. |
bool olp::dataservice::read::VersionedLayerClient::IsCached | ( | const geo::TileKey & | tile, |
bool | aggregated = false |
||
) | const |
Checks whether the tile is cached.
tile | The tile key. |
aggregated | The aggregated flag, used to specify whether the tile is aggregated or not. |
bool olp::dataservice::read::VersionedLayerClient::IsCached | ( | const std::string & | partition_id | ) | const |
Checks whether the partition is cached.
partition_id | The partition ID. |
client::CancellationToken olp::dataservice::read::VersionedLayerClient::PrefetchPartitions | ( | PrefetchPartitionsRequest | request, |
PrefetchPartitionsResponseCallback | callback, | ||
PrefetchPartitionsStatusCallback | status_callback = nullptr |
||
) |
Prefetches a set of partitions asynchronously.
This method downloads all partitions listed in PrefetchPartitionsRequest
. Only partitions that are not already present in the cache are downloaded. It helps reduce the network load.
GetData(DataRequest)
to retrieve partitions loaded by PrefetchPartitions
.request | The PrefetchPartitionsRequest instance that contains a complete set of request parameters. |
callback | The PrefetchPartitionsResponseCallback object that is invoked if the PrefetchPartitionsResult instance is available or an error occurs. |
status_callback | The PrefetchPartitionsStatusCallback object that is invoked every time a partition is fetched. |
client::CancellableFuture<PrefetchPartitionsResponse> olp::dataservice::read::VersionedLayerClient::PrefetchPartitions | ( | PrefetchPartitionsRequest | request, |
PrefetchPartitionsStatusCallback | status_callback = nullptr |
||
) |
Prefetches a set of partitions asynchronously.
This method downloads all partitions listed in PrefetchPartitionsRequest
. Only partitions that are not already present in the cache are downloaded. It helps reduce the network load.
GetData(DataRequest)
to retrieve partitions loaded by PrefetchPartitions
.request | The PrefetchPartitionsRequest instance that contains a complete set of request parameters. |
status_callback | The PrefetchPartitionsStatusCallback object that is invoked every time a partition is fetched. |
CancellableFuture
that contains the PrefetchPartitionsResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request. client::CancellableFuture<PrefetchTilesResponse> olp::dataservice::read::VersionedLayerClient::PrefetchTiles | ( | PrefetchTilesRequest | request, |
PrefetchStatusCallback | status_callback = nullptr |
||
) |
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.
request | The PrefetchTilesRequest instance that contains a complete set of request parameters. |
status_callback | The PrefetchStatusCallback object that is invoked every time a tile is fetched. |
CancellableFuture
that contains the PrefetchTilesResponse
instance with data or an error. You can also use CancellableFuture
to cancel this request. client::CancellationToken olp::dataservice::read::VersionedLayerClient::PrefetchTiles | ( | PrefetchTilesRequest | request, |
PrefetchTilesResponseCallback | callback, | ||
PrefetchStatusCallback | status_callback = nullptr |
||
) |
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.
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. |
status_callback | The PrefetchStatusCallback object that is invoked every time a tile is fetched. |
bool olp::dataservice::read::VersionedLayerClient::Protect | ( | const std::string & | partition_id | ) |
Protect partition from eviction.
Protecting partition means that its data and metadata keys are added to the protected list and stored in the cache. These keys are removed from the LRU cache, so they could not be evicted. Also, they do not expire.
Protect
while the Release
call for the same catalog and layer is in progress.partition_id | Partition id to be protected. |
bool olp::dataservice::read::VersionedLayerClient::Protect | ( | const std::vector< std::string > & | partition_ids | ) |
Protect partitions from eviction.
Protecting partitions means that its data and metadata keys are added to the protected list and stored in the cache. These keys are removed from the LRU cache, so they could not be evicted. Also, they do not expire.
Protect
while the Release
call for the same catalog and layer is in progress.partition_ids | Partition ids to be protected. |
bool olp::dataservice::read::VersionedLayerClient::Protect | ( | const TileKeys & | tiles | ) |
Protects tile keys from eviction.
Protecting tile keys means that its data and corresponding quadtree keys are added to the protected list and stored in the cache. These keys are removed from the LRU cache, so they could not be evicted. Also, they do not expire. The quadtree stays protected if at least one tile key is protected.
Protect
while the Release
call for the same catalog and layer is in progress.tiles | The list of tile keys to be protected. |
client::CancellationToken olp::dataservice::read::VersionedLayerClient::QuadTreeIndex | ( | TileRequest | tile_request, |
PartitionsResponseCallback | callback | ||
) |
Fetches a list of partitions including data size, checksum and crc asynchronously.
tile_request | The TileRequest 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. |
bool olp::dataservice::read::VersionedLayerClient::Release | ( | const std::string & | partition_id | ) |
Removes partition from protection.
Releasing partition id removes data handle and metadata keys from the protected list. The keys are added to the LRU cache, so they could be evicted. Expiration value is restored, and related to partition keys can expire.
Protect
will not be called for the same catalog and layer while the Release
call is in progress.partition_id | Partition id to be removed from protection. |
bool olp::dataservice::read::VersionedLayerClient::Release | ( | const std::vector< std::string > & | partition_ids | ) |
Removes partitions from protection.
Releasing partition ids removes data handle and metadata keys from the protected list. The keys are added to the LRU cache, so they could be evicted. Expiration value is restored, and related to partition keys can expire.
Protect
will not be called for the same catalog and layer while the Release
call is in progress.partition_ids | Partition ids to be removed from protection. |
bool olp::dataservice::read::VersionedLayerClient::Release | ( | const TileKeys & | tiles | ) |
Removes a list of tiles from protection.
Releasing tile keys removes data and quadtree keys from the protected list. The keys are added to the LRU cache, so they could be evicted. Expiration value is restored, and keys can expire. The quadtree can be removed from the protected list if all tile keys are no longer protected.
Protect
will not be called for the same catalog and layer while the Release
call is in progress.tiles | The list of tile keys to be removed from protection. |
bool olp::dataservice::read::VersionedLayerClient::RemoveFromCache | ( | const geo::TileKey & | tile | ) |
Removes the tile from the mutable disk cache.
tile | The tile key that should be removed. |
bool olp::dataservice::read::VersionedLayerClient::RemoveFromCache | ( | const std::string & | partition_id | ) |
Removes the partition from the mutable disk cache.
partition_id | The partition ID that should be removed. |
client::CancellationToken olp::dataservice::read::VersionedLayerClient::StreamLayerPartitions | ( | PartitionsRequest | partitions_request, |
PartitionsStreamCallback | partition_stream_callback, | ||
CallbackNoResult | callback | ||
) |
Fetches a list of partitions of the given generic layer asynchronously. Client does not cache the partitions, instead every partition is passed to the provided callback.
partitions_request | The PartitionsRequest instance that contains a complete set of request parameters. |
partition_stream_callback | The PartitionsStreamCallback that receives every fetched partition. |
callback | The CallbackNoResult object that is invoked when operation is complete or an error is encountered. |