Ivan Enderlin
4b70407bcd
feat(sdk): SlidingSyncBuilder implements Clone.
2023-04-26 16:05:03 +02:00
Ivan Enderlin
f26b9fb66c
Merge branch 'main' into feat-sdk-sliding-sync-cancellation-token
2023-04-26 12:19:02 +02:00
Ivan Enderlin
f17003f00e
chore(sdk): SlidingSync::stream takes a &self.
2023-04-26 11:19:11 +02:00
Ivan Enderlin
bb049489ef
feat(sdk): SlidingSyncList::on_list can return a value.
2023-04-26 11:18:38 +02:00
Kévin Commaille
51a2d101b6
base: Remove RoomMemberships::UNKNOWN/KNOWN
...
The unknown filter can be difficult to match with MembershipState,
depending on the store implementation.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-26 10:12:22 +02:00
Kévin Commaille
f7e8b22646
memory-store: indexeddb: Store memberships as MembershipState
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-26 10:12:22 +02:00
Kévin Commaille
252f4cb9a2
sled: Store memberships as strings
...
Storing as bitset is not future-proof.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-26 10:12:22 +02:00
Kévin Commaille
a511500e6e
indexeddb: Store memberships as strings
...
Storing as bitset is not future-proof.
Just fix the latest migration. We assume no-one used it yet.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-26 10:12:22 +02:00
Kévin Commaille
3081dabb66
base: Add method to match RoomMemberships with MembershipState
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-26 10:12:22 +02:00
Ivan Enderlin
1709089e6d
feat(sdk): SlidingSync sync loop can be controled via internal messages.
...
The MPSC channel that has been introduced in recent commits is now used
in this patch. The `SlidingSync::stream` method can be controlled via
the `internal_channel`.
This patch updates `SlidingSync::stream` to use the `tokio::select!
` macro to select any future that resolves first between the
`internal_channel` receiver, or `SlidingSync::sync_once`. Fairness is
biaised as the `internal_channel` has the priority.
This mechanism is already used by this patch: `SlidingSyncList::reset`
will send the `SlidingSyncInternalMessage::ContinueSyncLoop` to
“continue”… well… the sync loop, i.e. it will cancel in-flight waiting
for a response.
This entire mechanism removes the need to “stop” and “start”, i.e.
“restart” the `SlidingSync::stream` method manually, which was the
source of many bugs. Now everything is controlled internally.
2023-04-26 09:50:11 +02:00
Kévin Commaille
ae79fd0af5
sdk: Deprecate Common::(active/joined)_members(_no_sync)
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
b8f06ec4a1
sdk-base: Deprecate Room::(active/joined)_members
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
fe6424f48c
sdk: Implement Common::(active/joined)_members_no_sync with members_no_sync
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
2010c180a8
base-sdk: Implement Room::(active/joined)_members with members
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
e98fbfce9a
sdk: Allow to filter Common::members(_no_sync) by membership state
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
f68b45aa49
base-sdk:Allow to filter Room::members by membership state
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
81a543e15b
sdk-base: Deprecate get_invited_user_ids and get_joined_user_ids
...
get_user_ids can be used instead
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
4ffa20abde
sdk-base: Allow to filter get_user_ids results by any membership state
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Kévin Commaille
58a1ad1b93
base: Use single map for all user IDs in memory store
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-25 18:03:53 +02:00
Jonas Platte
bd3a37791b
Distinguish events from live sync and sync cache in debug string
2023-04-25 11:50:06 +02:00
Ivan Enderlin
7e243c5a5b
Merge branch 'main' into fix-issue-1728
2023-04-24 19:46:56 +02:00
Kévin Commaille
910c35b699
sled: Return all user IDs in get_user_ids
...
It would only return joined and invited user IDs,
since those are the only ones that were stored.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-24 18:54:29 +02:00
Kévin Commaille
3f1a596c8c
indexeddb: Return all user IDs in get_user_ids
...
It would only return joined and invited user IDs,
since those are the only ones that were stored.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-24 18:54:29 +02:00
Ivan Enderlin
5d63f0b215
chore(sdk): Move variables in a smaller scope to clarify the code.
2023-04-24 15:14:11 +02:00
Ivan Enderlin
304d1f445b
feat(sdk): SlidingSync types share a channel to talk to each other.
...
`SlidingSync` has a `Receiver`, `SlidingSyncList` has a `Sender`.
2023-04-24 14:17:33 +02:00
Ivan Enderlin
30abbe3cd4
feat(sdk): SlidingSync::add_list takes a SlidingSyncListBuilder.
...
Prior to this patch, `SlidingSync::add_list` was taking a
`SlidingSyncList`. However, we need to inject more data when building
the list, so let's modify `add_list` to take a `SlidingSyncListBuilder`
instead. It's even better for the user as calling `build()` isn't
necessary anymore.
2023-04-24 14:14:47 +02:00
Ivan Enderlin
7f5e61831e
chore(sdk): Remove a useless import.
2023-04-24 14:11:36 +02:00
Ivan Enderlin
3b8ce5c9b1
feat(sdk): Create SlidingSync::on_list.
2023-04-24 14:11:36 +02:00
Ivan Enderlin
e21d1fcb93
feat(sdk): SlidingSyncList no longer implement Clone.
...
It's not possible to clone a `SlidingSyncList` anymore. Why? Because
it's not correct. Prior to this patch, it was possible to add a list
to a `SlidingSync` instance, then add a clone of the same list to
another `SlidingSync` instance. Weird behaviors could happen, but more
importantly, for the next Sliding Sync design we are working on, it
could lead to gigantic bugs.
Removing `Clone` from `SlidingSyncList` makes the code simpler.
For example, `SlidingSyncList.inner` no longer needs an `Arc`, or
`SlidingSync::stream` no longer needs to clone all the lists.
2023-04-24 14:11:12 +02:00
Ivan Enderlin
f4e577bbe0
feat(sdk): Remove SlidingSync::pop_list.
...
This method is used by nobody. It's safe to remove it.
2023-04-24 14:07:27 +02:00
Jonas Platte
e5f4bbdc47
Upgrade dependencies
2023-04-24 13:59:01 +02:00
Ivan Enderlin
7b2b3fa78f
feat(sdk): Add support for bump_event_types in SlidingSync.
...
The `SlidingSyncBuilder` now has a new method: `bump_event_types`, to
configure the `bump_event_types` HTTP request parameter. This value
is passed to `SlidingSync`, which is used to build the `SlidingSync`
request.
2023-04-24 10:05:00 +02:00
Richard van der Hoff
0a0da040d2
account.rs: add some comments ( #1799 )
2023-04-20 13:01:44 +01:00
Jonas Platte
b532d35d21
Remove root_span from Client
2023-04-20 11:43:45 +02:00
Jonas Platte
530fceb40d
Fix some rustdoc warnings
2023-04-20 09:02:28 +02:00
Jonas Platte
7d5908beef
sdk: Add more data to RemoteEventTimelineItem Debug string
2023-04-20 09:02:09 +02:00
Jonas Platte
0e08d0f9ef
sdk: Make EventTimelineItem's fields pub(super)
...
… and avoid an unnecessary clone.
2023-04-19 14:17:16 +02:00
Jonas Platte
3f6c9956ab
sdk: Move timestamp to EventTimelineItem
...
… from Local/RemoteEventTimelineItem.
2023-04-19 14:17:16 +02:00
Jonas Platte
c97d8afa58
sdk: Remove extra visibility boundary on {Local,Remote}EventTimelineItem
2023-04-19 14:17:16 +02:00
Jonas Platte
abd508676e
sdk: Remove {Local,Remote}EventTimelineItem from public API
2023-04-19 14:17:16 +02:00
Jonas Platte
7376198dfa
sdk: Move sender, sender_profile, content to EventTimelineItem
...
… from Local/RemoteEventTimelineItem.
2023-04-19 14:17:16 +02:00
Jonas Platte
2960aafe3d
sdk: Make EventTimelineItem an opaque struct instead of an enum
2023-04-19 14:17:16 +02:00
Jonas Platte
bf4349ffb3
base-sdk: Don't separate member events from other state events
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-19 14:04:53 +02:00
Kévin Commaille
b87a4e8c20
base-sdk: Don't separate member events from other state events
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-04-19 13:16:55 +02:00
Alfonso Grillo
3b1ed1403d
sdk: Add DM invitation to m.direct account data upon accepting it
2023-04-18 18:05:48 +02:00
Alfonso Grillo
fe10bcc814
base: Use member event is_direct field for is_direct() on invited rooms
2023-04-18 18:05:48 +02:00
Jonas Platte
89c06568dd
Remove unneeded explicit lifetime
2023-04-18 15:20:51 +02:00
Alfonso Grillo
dffa1b16c3
sdk: Skip user's own ID when marking a room as DM
2023-04-18 13:41:34 +02:00
Jonas Platte
5bc20669c2
sdk: Implement MSC3925 for the timeline
...
https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3925-replace-aggregation-with-full-event.md
Implemented in Synapse 1.79.0:
https://github.com/matrix-org/synapse/releases/tag/v1.79.0
2023-04-18 13:14:33 +02:00
Jonas Platte
86930581a5
Upgrade Ruma
2023-04-18 13:14:33 +02:00