matrix-org / matrix-rust-sdk

Matrix Client-Server SDK for Rust
Apache License 2.0
1.26k stars 252 forks source link

refactor(send queue): refactor in preparation for media local echoes #4176

Closed bnjbvr closed 2 weeks ago

bnjbvr commented 2 weeks ago

This refactors the send queue so that it can apply sending more abstract requests, instead of only sending plain events. This will generalize to media uploads soon, but in the future might also generalize to sending redactions, etc. So we now queue requests, update requests, and so on; which leads to some fun renaming in a massive patch, but no changes in functionality. Those would come in subsequent pull requests.

Indexeddb has a database format change, that is gently handled the same way we did for is_wedged vs wedged errors, that is: the migration applies at the reading boundary (we can't use the #[serde(untagged)] enum trick because we're storing a raw JSON value, and this is known to be buggy in serde). Sqlite hasn't been modified yet.

Part of #1732.

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 95.83333% with 7 lines in your changes missing coverage. Please review.

Project coverage is 84.89%. Comparing base (ee80291) to head (acf79a4). Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/send_queue.rs 91.95% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4176 +/- ## ========================================== + Coverage 84.86% 84.89% +0.02% ========================================== Files 270 271 +1 Lines 29031 29035 +4 ========================================== + Hits 24637 24648 +11 + Misses 4394 4387 -7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bnjbvr commented 2 weeks ago

Wait, a rename of serialized JSON field names is a breaking change, since the field name is encoded next to the value, IIRC. Will have to do the sqlite migration here too \o/

bnjbvr commented 2 weeks ago

Wait, a rename of serialized JSON field names is a breaking change, since the field name is encoded next to the value, IIRC. Will have to do the sqlite migration here too \o/

nope