From 065cda83fab02aea85573d9c2d78e9121296582d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 23 Feb 2016 18:25:36 -0800 Subject: [core] Limit total number of offline Mapbox tiles --- include/mbgl/storage/default_file_source.hpp | 6 ++++++ include/mbgl/storage/offline.hpp | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'include/mbgl/storage') diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index 3e839bbc18..93d6297651 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -94,6 +94,12 @@ public: */ void deleteOfflineRegion(OfflineRegion&&, std::function); + /* + * 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(); diff --git a/include/mbgl/storage/offline.hpp b/include/mbgl/storage/offline.hpp index 2bc286dbab..a3153adc28 100644 --- a/include/mbgl/storage/offline.hpp +++ b/include/mbgl/storage/offline.hpp @@ -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 { -- cgit v1.2.1