diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-04-03 15:08:02 +0300 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-04-29 17:09:58 +0300 |
commit | 2604991b2b0090ed69893f6b156a6e640a789c9f (patch) | |
tree | d6b29f0a512b3de53fb4cc23d96cc2f52b1fdffe /platform/default/src/mbgl/storage/default_file_source.cpp | |
parent | 4c8295e67200e15979ddc0c6b16d9b09e4f0a192 (diff) | |
download | qtlocation-mapboxgl-2604991b2b0090ed69893f6b156a6e640a789c9f.tar.gz |
[core] Introduce resetCache API
Add an API to delete existing database and re-initialize.
Diffstat (limited to 'platform/default/src/mbgl/storage/default_file_source.cpp')
-rw-r--r-- | platform/default/src/mbgl/storage/default_file_source.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/storage/default_file_source.cpp b/platform/default/src/mbgl/storage/default_file_source.cpp index 1ccf999109..08fbbff9a0 100644 --- a/platform/default/src/mbgl/storage/default_file_source.cpp +++ b/platform/default/src/mbgl/storage/default_file_source.cpp @@ -177,6 +177,10 @@ public: offlineDatabase->put(resource, response); } + void resetCache(std::function<void (std::exception_ptr)> callback) { + callback(offlineDatabase->resetCache()); + } + private: expected<OfflineDownload*, std::exception_ptr> getDownload(int64_t regionID) { auto it = downloads.find(regionID); @@ -316,6 +320,10 @@ void DefaultFileSource::put(const Resource& resource, const Response& response) impl->actor().invoke(&Impl::put, resource, response); } +void DefaultFileSource::resetCache(std::function<void (std::exception_ptr)> callback) { + impl->actor().invoke(&Impl::resetCache, callback); +} + // For testing only: void DefaultFileSource::setOnlineStatus(const bool status) { |