|
29 | 29 | #include <olp/core/geo/tiling/TileKey.h> |
30 | 30 | #include <olp/dataservice/read/DataRequest.h> |
31 | 31 | #include <olp/dataservice/read/PartitionsRequest.h> |
| 32 | +#include <olp/dataservice/read/PrefetchTilesRequest.h> |
32 | 33 | #include <olp/dataservice/read/Types.h> |
33 | 34 |
|
34 | 35 | namespace olp { |
@@ -194,6 +195,53 @@ class DATASERVICE_READ_API VolatileLayerClient final { |
194 | 195 | */ |
195 | 196 | bool RemoveFromCache(const geo::TileKey& tile); |
196 | 197 |
|
| 198 | + /** |
| 199 | + * @brief Prefetches a set of tiles asynchronously. |
| 200 | + * |
| 201 | + * This method recursively downloads all tile keys from the `min_level` |
| 202 | + * parameter to the `max_level` parameter of the \c PrefetchTilesRequest |
| 203 | + * object for the given root tiles. If min_level/max_level are the same or |
| 204 | + * default, only tiles listed in \c PrefetchTilesRequest will be downloaded. |
| 205 | + * Only tiles will be downloaded which are not already present in the cache, |
| 206 | + * this helps reduce the network load. |
| 207 | + * |
| 208 | + * @note This method does not guarantee that all tiles are available offline |
| 209 | + * as the cache might overflow, and data might be evicted at any point. |
| 210 | + * |
| 211 | + * @param request The `PrefetchTilesRequest` instance that contains |
| 212 | + * a complete set of request parameters. |
| 213 | + * @param callback The `PrefetchTilesResponseCallback` object that is invoked |
| 214 | + * if the `PrefetchTilesResult` instance is available or an error is |
| 215 | + * encountered. |
| 216 | + * |
| 217 | + * @return A token that can be used to cancel this request. |
| 218 | + */ |
| 219 | + client::CancellationToken PrefetchTiles( |
| 220 | + PrefetchTilesRequest request, PrefetchTilesResponseCallback callback); |
| 221 | + |
| 222 | + /** |
| 223 | + * @brief Prefetches a set of tiles asynchronously. |
| 224 | + * |
| 225 | + * This method recursively downloads all tile keys from the `min_level` |
| 226 | + * parameter to the `max_level` parameter of the \c PrefetchTilesRequest |
| 227 | + * object for the given root tiles. If min_level/max_level are the same or |
| 228 | + * default, only tiles listed in \c PrefetchTilesRequest will be downloaded. |
| 229 | + * Only tiles will be downloaded which are not already present in the cache, |
| 230 | + * this helps reduce the network load. |
| 231 | + * |
| 232 | + * @note This method does not guarantee that all tiles are available offline |
| 233 | + * as the cache might overflow, and data might be evicted at any point. |
| 234 | + * |
| 235 | + * @param request The `PrefetchTilesRequest` instance that contains |
| 236 | + * a complete set of request parameters. |
| 237 | + * |
| 238 | + * @return `CancellableFuture` that contains the `PrefetchTilesResponse` |
| 239 | + * instance with data or an error. You can also use `CancellableFuture` to |
| 240 | + * cancel this request. |
| 241 | + */ |
| 242 | + client::CancellableFuture<PrefetchTilesResponse> PrefetchTiles( |
| 243 | + PrefetchTilesRequest request); |
| 244 | + |
197 | 245 | private: |
198 | 246 | std::unique_ptr<VolatileLayerClientImpl> impl_; |
199 | 247 | }; |
|
0 commit comments