matrix-org / matrix-rust-sdk

Matrix Client-Server SDK for Rust
Apache License 2.0
1.13k stars 222 forks source link

Sender Data: Background task to retry fetching sender data for megolm sessions #3546

Open andybalaam opened 3 weeks ago

andybalaam commented 3 weeks ago

Launch a background task when we start that retries fetching sender data for megolm sessions.

Part of https://github.com/matrix-org/matrix-rust-sdk/issues/3544 which is part of Invisible Crypto.

The algorithm below mentions jumping to certain steps. This is referring to the algorithm in https://github.com/matrix-org/matrix-rust-sdk/issues/3543 .

Algorithm

This handles all of the following scenarios:

In each case we will query the store for these sessions and retry them, updating their retry count if we need to continue waiting.

The background job begins on startup and repeatedly does the following:

Each session gets its own independent background task, which is OK because tasks are light and they all just wait for the same keys/query to finish. After that, they may save to the store, which might cause some contention but is probably fine.

poljar commented 3 weeks ago

If every instance of session here means megolm session, can we please use the "room key" term instead. I know that we call this the InboundGroupSession in the crypto crate, but perhaps we should reconsider this name as well.

dkasak commented 3 weeks ago

We don't differentiate enough between the Matrix layer things and the Olm/Megolm layer things. If anything should have the name "Megolm session", it should be the low level packets described in https://gitlab.matrix.org/matrix-org/olm/-/blob/master/docs/megolm.md#data-exchange-formats. The m.room_key thing on the Matrix layer should never be called a Megolm session but a room key or message key.

andybalaam commented 3 weeks ago

@BillCarsonFr should I search-and-replace "session" -> "room key" everywhere in this issue and its parents?