Skip to content
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

feat(sdk): Improve RoomEventCacheUpdate #3471

Merged

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented May 27, 2024

This patch improves/refactors RoomEventCacheUpdate a little bit. That's preliminary work to support VectorDiff from the EventCache into the Timeline.


Hywan added 4 commits May 27, 2024 10:48
This patch renames `RoomEventCacheUpdate::UpdateReadMarker` to
`ReadMarker`. The `Update` prefix is already part of the enum name.
…ve_to`.

This patch renames `RoomEventCacheUpdate::ReadMarker::event_id` to
`ReadMarker::move_to` as I feel like it conveys a better semantics.
This patch extracts `RoomEventCacheUpdate::Append::ambiguity_changes`
into a new variant `RoomEventCacheUpdate::Members { ambiguity_changes }
`.

This patch also creates a new private
`RoomEventCacheInner::send_grouped_updates_for_events` method to ensure
the updates are sent in a particular order.
This patch renames `RoomEventCacheUpdate::Append` to `SyncEvents`. The
field `events` is renamed `timeline`.

This patch also renames some variables to clarify the code and to match
the renamings in `RoomEventCacheUpdate`.
@Hywan Hywan requested a review from a team as a code owner May 27, 2024 11:42
@Hywan Hywan requested review from poljar and removed request for a team May 27, 2024 11:42
@Hywan Hywan mentioned this pull request May 27, 2024
34 tasks
@bnjbvr bnjbvr requested review from bnjbvr and removed request for poljar May 27, 2024 12:08
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think most of these renamings lower clarity, introduce confusion and/or break preexisting conventions around the event cache. I'm fine with SyncEvents, but the rest should be re-discussed and made consistent, at the very least.

crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
Hywan added 4 commits May 27, 2024 16:42
This patch renames `ReadMarker { move_to: … }` to `MoveReaderMarkerTo
{ event_id: … }`.

This patch also renames `Members` to `UpdateMembers`.

Finally, this patch renames some other variables to avoid clashes with
terminology in `matrix_sdk_ui`.
This patch splits `RoomEventCacheUpdate::SyncEvents` into 2 new variants:
`AddTimelineEvents` and `AddEphemeralEvents`.

This patch takes this opportunity to update `matrix_sdk_ui::timeline`
a little bit too. `handle_sync_events` is renamed
`handle_ephemeral_events`, and the `SyncTimelineEvent` argument is
removed: it's possible to use `add_events_at` directly to handle the
`SyncTimelineEvent`s.
This patch prevents sending useless `RoomEventCacheUdpate` if their
respective values are empty.
@Hywan Hywan force-pushed the feat-sdk-event-cache-use-linked-chunk-as-vector branch from b5ccc54 to 3b1b893 Compare May 27, 2024 14:58
@Hywan Hywan requested a review from bnjbvr May 27, 2024 14:58
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/event_cache/mod.rs Outdated Show resolved Hide resolved
Signed-off-by: Benjamin Bouvier <[email protected]>
@bnjbvr bnjbvr enabled auto-merge (squash) May 28, 2024 08:58
Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 83.29%. Comparing base (1dc3709) to head (3a2323d).
Report is 25 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk-ui/src/timeline/inner/state.rs 61.53% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3471      +/-   ##
==========================================
- Coverage   83.29%   83.29%   -0.01%     
==========================================
  Files         248      248              
  Lines       25236    25245       +9     
==========================================
+ Hits        21021    21028       +7     
- Misses       4215     4217       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bnjbvr bnjbvr merged commit 664a64b into matrix-org:main May 28, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants