matrix-org / matrix-org/matrix-rust-sdk

Allow iOS consumers to setup for us to call `beginBackgroundTask` and `endBackgroundTask`

Open
#1,750 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.