Open bnjbvr opened 9 months ago
(moved to OP)
Finally read this through fully. fwiw, from my side, the overall idea is great. However (as per our chat on mon):
event graph
)Event Cache
is nice: it had been suggested to me privately by someone else, it also makes it clear that it can be cleared up at any time, "just" resulting in a lesser user experience. Also I haven't had any other suggestions, and I'd like to move on with the renaming, so let's settle on EventCache
at the moment :grin:
Something we want to be sure to not reproduce in the Rust SDK: https://github.com/element-hq/element-web/issues/18325#issuecomment-1264038949
A few additional things to not reproduce in the rust SDK:
Context
After working for a bit on the Rust SDK, I've observed it seems there's a missing layer between the high-level Timeline in the UI crate, and the Rust SDK itself. In addition to rendering the events themselves, the Timeline is involved in a lot of functionality:
prev_batch
tokens, re-spawning requests to/messages
until it reaches a desired amount of messages, or the end of a timeline,These extra responsibilities make the Timeline more a view-and-controller bundle, as opposed to a pure view over the events it receives. This tight coupling comes as an advantage (the code freely does what it needs when it needs to), but also it comes with a few drawbacks: it's harder to test and fix a logic bug in isolation without rendering a timeline, and all that functionality is not reusable by other clients who wouldn't want to render as a timeline.
Since rendering a timeline requires subscribing to the room it belongs to, and we have requirements for other features that don't involve a specific room, but the entire room list, some of that functionality is re-implemented elsewhere:
latest_event
for a room, so as we have something to display in the room list,RoomInfo
struct, into the state store.The Proposal
Overall, my take is that all this kind of functionality is really nice to have, when writing any Matrix client. While it's possible that we could continue like we've done so far, I think that having a new abstraction to provide all this functionality, independently of a given observed room, would be super nice and useful. I call this new abstraction the Event Graph (API, if you insist).
The goals are the following:
Unknowns
1103 contains a few interesting remarks and caveats about memory usage and having a timeline cache.
Drawbacks
TL;DR
This is a proposal to weed out some functionality out of the timeline and matrix-sdk-base client into a new Event Graph API, to make it simpler to add new features in the future, that will benefit all the users of the Rust SDK, for Fractal, all the Element(X) apps, and all the users of the SDK.
Subprojects
3280
3872
4112
4113