[core] Limit total number of offline Mapbox tiles

This commit is contained in:
John Firebaugh
2016-02-23 18:25:36 -08:00
parent 5cefaeb857
commit 065cda83fa
11 changed files with 261 additions and 15 deletions

View File

@@ -94,6 +94,12 @@ public:
*/
void deleteOfflineRegion(OfflineRegion&&, std::function<void (std::exception_ptr)>);
/*
* Changing or bypassing this limit without permission from Mapbox is prohibited
* by the Mapbox Terms of Service.
*/
void setOfflineMapboxTileCountLimit(uint64_t) const;
// For testing only.
void put(const Resource&, const Response&);
void goOffline();

View File

@@ -150,6 +150,22 @@ public:
* re-executes the user-provided implementation on the main thread.
*/
virtual void responseError(Response::Error) {}
/*
* Implement this method to be notified when the limit on the number of Mapbox
* tiles stored for offline regions has been reached.
*
* Once the limit has been reached, the SDK will not download further offline
* tiles from Mapbox APIs until existing tiles have been removed. Contact your
* Mapbox sales representative to raise the limit.
*
* This limit does not apply to non-Mapbox tile sources.
*
* Note that this method will be executed on the database thread; it is the
* responsibility of the SDK bindings to wrap this object in an interface that
* re-executes the user-provided implementation on the main thread.
*/
virtual void mapboxTileCountLimitExceeded(uint64_t /* limit */) {}
};
class OfflineRegion {