matrix-org / matrix-org/matrix-rust-sdk
Allow iOS consumers to setup for us to call `beginBackgroundTask` and `endBackgroundTask`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
On iOS the OS might kill us if we're in the middle of a database write[[1]] while the OS tries to put the application into the background.
Since all the database handling is happening in the Rust SDK, the client doesn't know when a write might start. If the client is using only the crypto crate, it might guess fairly well when this is going to happen, but otherwise not.
We should provide a trait that people can implement, even over FFI[[2]], and we'll call the method each time before and after we commit things to the store.
[1]: https://developer.apple.com/documentation/xcode/understanding-the-exception-types-in-a-crash-report#EXCCRASH-SIGKILL
[2]: https://mozilla.github.io/uniffi-rs/udl/callback_interfaces.html
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reading the Apple background-task and UniFFI callback-interface references, then trace where the Rust SDK commits database writes; done means an implementable callback is invoked before and after store commits, including for iOS consumers over FFI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, rust
- Domain
- database, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100