diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/storage/default_file_source.hpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index ddbdab8cf3..f46f41771e 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -30,12 +30,8 @@ public: * regions, we want the database to remain fairly small (order tens or low hundreds * of megabytes). */ - DefaultFileSource(const std::string& cachePath, - const std::string& assetPath, - uint64_t maximumCacheSize = util::DEFAULT_MAX_CACHE_SIZE); - DefaultFileSource(const std::string& cachePath, - std::unique_ptr<FileSource>&& assetFileSource, - uint64_t maximumCacheSize = util::DEFAULT_MAX_CACHE_SIZE); + DefaultFileSource(const std::string& cachePath, const std::string& assetPath); + DefaultFileSource(const std::string& cachePath, std::unique_ptr<FileSource>&& assetFileSource); ~DefaultFileSource() override; bool supportsCacheOnlyRequests() const override { @@ -220,6 +216,28 @@ public: */ void clearAmbientCache(std::function<void (std::exception_ptr)>); + /* + * Sets the maximum size in bytes for the ambient cache. + * + * This call is potentially expensive because it will try + * to trim the data in case the database is larger than the + * size defined. The size of offline regions are not affected + * by this settings, but the ambient cache will always try + * to not exceed the maximum size defined, taking into account + * the current size for the offline regions. + * + * If the maximum size is set to 50 MB and 40 MB are already + * used by offline regions, the cache size will be effectively + * 10 MB. + * + * Setting the size to 0 will disable the cache if there is no + * offline region on the database. + * + * This method should always be called before using the database, + * otherwise the default maximum size will be used. + */ + void setMaximumAmbientCacheSize(uint64_t size, std::function<void (std::exception_ptr)> callback); + // For testing only. void setOnlineStatus(bool); |