matrix-org / matrix-rust-sdk

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

Reconcile or unify `RoomEvents` event chunks with `AllEventsCache` events #3886

Open jmartinesp opened 2 months ago

jmartinesp commented 2 months ago

In EventCache::save_event there is this comment that says:

This doesn't insert the event into the linked chunk. In the future there'll be no distinction between the linked chunk and the separate cache.

And we have 2 separate caches now: one for chunks of events for timelines of rooms (RoomEvents), which come from room timeline updates during syncs and back pagination, and another one for any event in any room and their related events (AllEventsCache), which may come from any source.

I believe the end goal here is using a persistent storage to hold a cache that unifies both of these, and it's probably related to the 'implement a basic reconciliation of events; don't handle separate connected components of events yet' point in https://github.com/matrix-org/matrix-rust-sdk/issues/3058. I'm opening this issue to both discuss if this is the way we want to proceed and, if it is, keep some recording of it.

bnjbvr commented 2 months ago

After we've implemented proper persistent storage for events, I'd expect that the second AllEventsCache would read from the database, instead of storing any information in memory, so we can likely fold this as one item of #3280?