diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-06-14 15:11:32 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-06-18 16:26:51 +0300 |
commit | 68e3cbacbc35ae6cd6c1e0fe2ab59ed262c32786 (patch) | |
tree | a8eb342508e1b089d05eb4c35bb1ce424ecee088 /platform/default/include/mbgl/storage/offline_database.hpp | |
parent | 78eeffe1717a37a91e6c59681421a20c52a4d003 (diff) | |
download | qtlocation-mapboxgl-68e3cbacbc35ae6cd6c1e0fe2ab59ed262c32786.tar.gz |
[core] Add method for setting a maximum size for the ambient cache
- Removed this parameter from the constructor, now that we
have a method to set it.
- Add the method and enforce the limits if the ambient cache exceeds the
size.
Diffstat (limited to 'platform/default/include/mbgl/storage/offline_database.hpp')
-rw-r--r-- | platform/default/include/mbgl/storage/offline_database.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/default/include/mbgl/storage/offline_database.hpp b/platform/default/include/mbgl/storage/offline_database.hpp index 59f41a723f..afce87b542 100644 --- a/platform/default/include/mbgl/storage/offline_database.hpp +++ b/platform/default/include/mbgl/storage/offline_database.hpp @@ -40,7 +40,7 @@ class OfflineDatabase : private util::noncopyable { public: // Limits affect ambient caching (put) only; resources required by offline // regions are exempt. - OfflineDatabase(std::string path, uint64_t maximumCacheSize = util::DEFAULT_MAX_CACHE_SIZE); + OfflineDatabase(std::string path); ~OfflineDatabase(); void changePath(const std::string&); @@ -86,6 +86,7 @@ public: expected<OfflineRegionDefinition, std::exception_ptr> getRegionDefinition(int64_t regionID); expected<OfflineRegionStatus, std::exception_ptr> getRegionCompletedStatus(int64_t regionID); + std::exception_ptr setMaximumAmbientCacheSize(uint64_t); void setOfflineMapboxTileCountLimit(uint64_t); uint64_t getOfflineMapboxTileCountLimit(); bool offlineMapboxTileCountLimitExceeded(); @@ -104,6 +105,7 @@ private: void migrateToVersion3(); void migrateToVersion6(); void cleanup(); + bool disabled(); mapbox::sqlite::Statement& getStatement(const char *); @@ -136,9 +138,9 @@ private: template <class T> T getPragma(const char *); - uint64_t maximumCacheSize; - + uint64_t maximumAmbientCacheSize = util::DEFAULT_MAX_CACHE_SIZE; uint64_t offlineMapboxTileCountLimit = util::mapbox::DEFAULT_OFFLINE_TILE_COUNT_LIMIT; + optional<uint64_t> offlineMapboxTileCount; bool evict(uint64_t neededFreeSize); |