[core] Rename resetCache to resetDatabase
Avoid confusion about what is being reset. In this case, the whole database and not only the ambient cache.
This commit is contained in:
@@ -192,7 +192,7 @@ public:
|
||||
* executed on the database thread; it is the responsibility of the SDK bindings
|
||||
* to re-execute a user-provided callback on the main thread.
|
||||
*/
|
||||
void resetCache(std::function<void (std::exception_ptr)>);
|
||||
void resetDatabase(std::function<void (std::exception_ptr)>);
|
||||
|
||||
/*
|
||||
* Forces revalidation of tiles in the ambient cache.
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
~OfflineDatabase();
|
||||
|
||||
void changePath(const std::string&);
|
||||
std::exception_ptr resetCache();
|
||||
std::exception_ptr resetDatabase();
|
||||
|
||||
optional<Response> get(const Resource&);
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ public:
|
||||
offlineDatabase->put(resource, response);
|
||||
}
|
||||
|
||||
void resetCache(std::function<void (std::exception_ptr)> callback) {
|
||||
callback(offlineDatabase->resetCache());
|
||||
void resetDatabase(std::function<void (std::exception_ptr)> callback) {
|
||||
callback(offlineDatabase->resetDatabase());
|
||||
}
|
||||
|
||||
void invalidateTileCache(std::function<void (std::exception_ptr)> callback) {
|
||||
@@ -339,8 +339,8 @@ 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);
|
||||
void DefaultFileSource::resetDatabase(std::function<void (std::exception_ptr)> callback) {
|
||||
impl->actor().invoke(&Impl::resetDatabase, std::move(callback));
|
||||
}
|
||||
|
||||
void DefaultFileSource::invalidateTileCache(std::function<void (std::exception_ptr)> callback) {
|
||||
|
||||
@@ -1195,7 +1195,7 @@ bool OfflineDatabase::exceedsOfflineMapboxTileCountLimit(const Resource& resourc
|
||||
&& offlineMapboxTileCountLimitExceeded();
|
||||
}
|
||||
|
||||
std::exception_ptr OfflineDatabase::resetCache() try {
|
||||
std::exception_ptr OfflineDatabase::resetDatabase() try {
|
||||
removeExisting();
|
||||
initialize();
|
||||
return nullptr;
|
||||
|
||||
@@ -222,7 +222,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
|
||||
view->clearAnnotations();
|
||||
break;
|
||||
case GLFW_KEY_I:
|
||||
view->resetCacheCallback();
|
||||
view->resetDatabaseCallback();
|
||||
break;
|
||||
case GLFW_KEY_K:
|
||||
view->addRandomCustomPointAnnotations(1);
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
void setResetCacheCallback(std::function<void()> callback) {
|
||||
resetCacheCallback = callback;
|
||||
resetDatabaseCallback = callback;
|
||||
};
|
||||
|
||||
void setShouldClose();
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
std::function<void()> changeStyleCallback;
|
||||
std::function<void()> pauseResumeCallback;
|
||||
std::function<void()> onlineStatusCallback;
|
||||
std::function<void()> resetCacheCallback;
|
||||
std::function<void()> resetDatabaseCallback;
|
||||
std::function<void(mbgl::Map*)> animateRouteCallback;
|
||||
|
||||
mbgl::util::RunLoop runLoop;
|
||||
|
||||
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
|
||||
});
|
||||
|
||||
view->setResetCacheCallback([fileSource] () {
|
||||
fileSource->resetCache([](std::exception_ptr ex) {
|
||||
fileSource->resetDatabase([](std::exception_ptr ex) {
|
||||
if (ex) {
|
||||
mbgl::Log::Error(mbgl::Event::Database, "Failed to reset cache:: %s", mbgl::util::toString(ex).c_str());
|
||||
}
|
||||
|
||||
@@ -1474,7 +1474,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(MergeDatabaseWithDiskFull)) {
|
||||
}
|
||||
#endif // __QT__
|
||||
|
||||
TEST(OfflineDatabse, ChangePath) {
|
||||
TEST(OfflineDatabase, ChangePath) {
|
||||
std::string newPath("test/fixtures/offline_database/test.db");
|
||||
OfflineDatabase db(":memory:");
|
||||
db.changePath(newPath);
|
||||
@@ -1482,13 +1482,13 @@ TEST(OfflineDatabse, ChangePath) {
|
||||
util::deleteFile(newPath);
|
||||
}
|
||||
|
||||
TEST(OfflineDatabse, resetCache) {
|
||||
TEST(OfflineDatabase, ResetDatabase) {
|
||||
FixtureLog log;
|
||||
deleteDatabaseFiles();
|
||||
util::copyFile(filename, "test/fixtures/offline_database/satellite_test.db");
|
||||
|
||||
OfflineDatabase db(filename);
|
||||
auto result = db.resetCache();
|
||||
auto result = db.resetDatabase();
|
||||
EXPECT_FALSE(result);
|
||||
|
||||
auto regions = db.listRegions().value();
|
||||
|
||||
Reference in New Issue
Block a user