matrix-org / matrix-org/matrix-rust-sdk
Find a better place for the pos persistance
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
The `pos` is a token which keeps track of where the client got in the sync stream for sliding sync. It's similar to the `next-batch` token concept from sync v2.
As such, it is useful to persist the `pos` between client restarts so the client may continue where they left off.
Since we have relatively complex multi-process situation on iOS, this value had to be stored in a cross-process safe manner.
As such we introduced a hack to persist the `pos` in the crypto store.
https://github.com/matrix-org/matrix-rust-sdk/blob/d039dad23af9fc7bd2181b668c96e68be7594532/crates/matrix-sdk/src/sliding_sync/cache.rs#L56-L69
This works relatively well, but users which don't use the end-to-end encryption feature lose this functionality. We should find a new home for this value.
Since the event cache store is now cross-process compatible it seems like the best candidate.
Contributor guide
Research direction
Start with crates/matrix-sdk/src/sliding_sync/cache.rs around the linked persistence code, then inspect the event cache store's cross-process storage APIs. Trace how the sliding-sync pos is read and written, move its persistence to the event cache store, and verify that clients without end-to-end encryption retain the position across restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100