Skip to content

Conversation

kstenerud
Copy link
Contributor

@kstenerud kstenerud commented Sep 22, 2025

This PR adds a new Storage that uses bd_resilient_kv under the hood, which gives us crash-resilient storage of the globals.

This allows us to move off the Preferences (Android) and UserDefaults (iOS) implementations on mobile.

@kstenerud kstenerud force-pushed the karl/resilient-storage branch 3 times, most recently from 17cd857 to f2abb93 Compare September 22, 2025 15:15
@kstenerud kstenerud marked this pull request as ready for review September 22, 2025 15:16
@kstenerud kstenerud requested review from Copilot, mattklein123 and snowp and removed request for Copilot September 22, 2025 15:16
Copy link
Contributor

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with small nit.

@kstenerud kstenerud force-pushed the karl/resilient-storage branch 2 times, most recently from 932d51f to e8e18d7 Compare September 22, 2025 15:50
}
}

impl Storage for ResilientKvStorage {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this later but now that there is a single implementation for Storage we should probably improve the Storage API a bit so that we can store more than just string types. For example the global fields are stored as a map serialized into a string but seems like we should be able to use better types within the storage at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the underlying system supports everything JSON does, and I've also developed a BONJSON extension to support other types (planned for inclusion into KSCrash, but we can also use it here), such as fixed-type arrays and dates and UUIDs. https://github.com/kstenerud/Orb

@kstenerud kstenerud force-pushed the karl/resilient-storage branch from e8e18d7 to 128d1c1 Compare September 23, 2025 14:56
@kstenerud kstenerud merged commit 99eaa5d into main Sep 23, 2025
6 checks passed
@kstenerud kstenerud deleted the karl/resilient-storage branch September 23, 2025 16:56
@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants