-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[meta] Room List API #1911
Comments
This looks really great. Thanks for compiling the tasks. They look good to me. I have just few remarks or questions: I am bit scared with the tiny Should we plan works around caching? Will data from all list be stored?
It is mandatory for the
There will be a new API, an updated version of An extension to this behavior would be to use |
The |
We must rely on the caching API of |
I wonder how it will fit… |
One note on something we just realised: once your session expires we need to restart the initial app SS flow (in which we start with a small range and small limits etc.) to avoid long initial syncs e.g. don't continue from a full all rooms range. |
@Hywan Can we please make sure we run this with all the "common extensions"? |
@Hywan Note: we need a replacement for the old |
@Hywan Like we talked about today we should introduce custom RoomListService list states: not-loaded, partially loaded (from cache or growing underneath) and loaded |
@Hywan We also talked about removing duplicates (checking move operations i.e delete + insert) and doing transactional diff publishing on both the room list and the timeline |
Image generated with DeepAI
We want to provide a
RoomList
API insidematrix-sdk
. The goal is to provide an abstraction on top ofSlidingSync
for classical usages of it, for example in common clients (ElementX, Fractal etc.). This can also be used by bots and so on.This meta issue provides a list of issues to achieve this goal.
Step 1, the foundation
The idea is the following. It happens in 2 phases:
RoomList
will create oneall_rooms
list, withSelective
mode andtimeline_limit = 0
, and a range of 20/30 rooms, so that we can sync a small room list, with no timeline but at least their names,all_rooms
has received a response, we change its mode toGrowing
with a batch of 100, still withtimeline_limit = 0
, and it will sync all rooms, one after the other:visible_rooms
list, withSelective
mode andtimeline_limit = 1
Right now, it's not possible to change the mode of a list. But nothing is difficult: it's a matter of resetting it, and exposing a setter for the mode.
This workflow above avoids to merge multiple lists together, as described in #1644 and as done right now by ElementX iOS, which can be very tricky and error-prone.
Main PRs are:
RoomList
, step 1: the Foundation #1953SlidingSyncList
on-the-fly.SlidingSyncMode
should hold thebatch_size
andmaximum_number_of_rooms_to_fetch
forGrowing
andPaging
, instead of passing it to the list builder:SlidingSyncMode
has richer variants #1941SlidingSyncList::set_mode(SlidingSyncMode)
method will be enough to re-configure the list with all the data it needs.SlidingSyncList::set_sync_mode
#1942crates/matrix-sdk-ui/src/room_list.rs
module. It's outside thecrates/matrix-sdk/src/sliding_sync/
module on purpose.room_list
from a particular list toRoomList
(i.e. it will be fromall_rooms
).room_list
to the public which is a “duplicate” of the previous list above, because it can be filtered. Maybe, let's take time to think about aFilteredObservable
type, or aFilteredSubscriber
, or something like this. This will allow to support fuzzy search. The general idea is to have a “source of truthroom_list
” and a “publicroom_list
” that can be filteredUpdate the timeline_limit maybe(not necessary)Update the batch size maybe(not necessary)Be able to register observers for:(not necessary)state
,maximum_number_of_rooms
,room_list
diffs etc.SlidingSyncRoom
RoomList
+ notification counts #2069Step 2, moaaar features
invite
list (need to define what it is)RoomList::invites
#2094RoomList
+ notification counts #2069Room
API, as defined in https://github.com/vector-im/element-x-ios/blob/develop/ElementX/Sources/Services/Room/RoomProxy.swift#L66RoomList
#2054RoomList
#2054RoomList
:RoomListService
#2128Step 3, the clean up and appendix tasks
RoomList
FFI bindingsRoomList
API #2035bump_event_types
forall_rooms
inRoomList
#2097M_UNKNOWN_POS
#2103SyncOp
s #2152bindings/matrix-sdk-ffi/src/sliding_sync.rs
module, as we no longer need to provide and to maintain bindings for the momentStep 4, make
RoomList
fasteeeerRoomList
is fast, but sometimes we see some “slowness”. They might not be related toRoomList
itself, but I think this issue is a good place to reference them and to explain them, as the root is this newRoomList
API.Room::latest_event()
needs to build aTimeline
to get the latest event. It's the secondTimeline
thatRoom
builds: the first one isRoom::timeline()
. It seems really suboptimal to do so. Re-enable the room list cache #2085 explains how storing the room's display name and the room's latest event directly insideRoomInfo
would have a twofold advantage:Room::latest_event()
faster, thus removing the need to build an intermediate sneakyTimeline
just for that (bonus: it also removes a crash in ElementX when they build this SDK in debug mode, hellorustc
bug :-]),RoomList
.Room::timeline()
builds a newTimeline
as we said at the previous item. Sometimes,TimelineBuilder::build
can take times to finish because it retries to decrypt event.VectorDiff
we send to the user. When a room goes ouf of range, it becomesInvalidated
, then once its synced again, it becomesFilled
again. The problem is that the client app have to create a newRoom
everytime, which is expensive because of the points above.SlidingSyncList::room_list
's capacity #2147RoomListService
's rooms #2163Room::latest_event
fast (depends on Re-enable the room list cache #2085)RoomListService
(revert feat: Cache theRoomListService
's rooms #2163). Why? Because the cache will keepRoom
s even if the user has left them. That's not annoying for the moment as it's an “edge case”, it rarely happens, but we want something clean, remember :-)? We need a cache to avoid re-creatingTimeline
s everytime, which can be slow, hence using theRingBuffer
I've recently introduced (feat(common): Propose a simpleRingBuffer
implementation #2154), so that we keep track/a cache of the latest most used rooms.SlidingSyncList::room_list
's capacity to a smaller value (partially revert fix(sdk): ChangeSlidingSyncList::room_list
's capacity #2147)TODO
in Sliding Sync #2332RoomListEntry::Invalidate
eyeball::Subscriber
that does “batch updates”RoomList::entries
andRoomList::entries_filtered
. #2322Room
very cheap to buildHere are the list of extra issues we track:
Timeline
#2107TimelineBuilder::build
logs more data #2109RoomListService
's rooms and associated events #2161The text was updated successfully, but these errors were encountered: