Replies: 6 comments
-
What you asked, is not that simple. While doing the file copy (from outside the MMKV framework), There's no way to guarantee that the files won't be corrupted by the running App, nor does the unsynced data in mmap-memory won't get lost. If we are about to support backup & restore instruction, we have to do it right. It requires some heavy operations such as accruing exclusive locks of the files, replacing them robustly and re-initialize the MMKV instance. So yes we will do it. And no it won't be quick. |
Beta Was this translation helpful? Give feedback.
-
Alright, I missed those points when I assumed this wouldn't be hard to implement 😅 This is what I had in mind: MMKV.stopAndClearMMAP();
// user restores backup (replaces all files in mmkv folder)
MMKV.initialize(); // or MMKV.reinitialize(); Of course, the public String decodeString(String key) {
if (this.stopped) {
return "";
}
} Or maybe a file reader/writer interfaces can be replaced with dummy ones when the Anyways those are just the thoughts I had once I read your reply. Also, I know it won't be quick as you mentioned earlier, but are there any estimates (like a month, three months or a year), roadmap or maybe a bug bounty so people can influence the priorities? Sorry for so many questions :) |
Beta Was this translation helpful? Give feedback.
-
I will say in 3 months or sonner, but no guarantee about that. |
Beta Was this translation helpful? Give feedback.
-
Great, thank you for all updates :) |
Beta Was this translation helpful? Give feedback.
-
Supported in v1.2.11. |
Beta Was this translation helpful? Give feedback.
-
Where is the docs about restore? |
Beta Was this translation helpful? Give feedback.
-
The language of MMKV
React-native wrapper / C++
The version of MMKV
react-native version: v0.6.0
MMKV: v1.2.7
The platform of MMKV
Android
The installation of MMKV
Git clone
What's the issue?
Currently, it is not possible to programmatically restart an application, so it is annoying to ask the users to restart the app after a backup is restored, can this be done without restarting the app?
I assume implementing this wouldn't be hard, a
reinitialize
method on an MMKV instance that simply reloads the data from the files.Beta Was this translation helpful? Give feedback.
All reactions