Skip to content

refactor!(event cache): introduce LinkedChunkId in the backends#5182

Merged
bnjbvr merged 8 commits intomainfrom
bnjbvr/migrate-ec-store-apis-for-threads
Jun 9, 2025
Merged

refactor!(event cache): introduce LinkedChunkId in the backends#5182
bnjbvr merged 8 commits intomainfrom
bnjbvr/migrate-ec-store-apis-for-threads

Conversation

@bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jun 5, 2025

In a "soon" future, threads have their own linked chunk. All our code has been written with the fact that a linked chunk belong to a room in mind, so it needs some biggish update. Fortunately, most of the changes are mechanical, so they should be rather easy to review.

Part of #4869, namely #5122.

@bnjbvr bnjbvr requested a review from a team as a code owner June 5, 2025 16:57
@bnjbvr bnjbvr requested review from andybalaam and removed request for a team June 5, 2025 16:57
@Hywan Hywan requested review from Hywan and removed request for andybalaam June 5, 2025 17:39
Copy link
Member Author

@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.

(Self-review, since I thought about the code this morning…)

bnjbvr added 7 commits June 9, 2025 11:25
There'll be one per room and then one per thread (which is the thread +
root event id). Also introduce a few methods to help comparing them,
converting from one to the other, etc.
…s` to `clear_all_linked_chunks`

Since it also clears the thread linked chunks.
@bnjbvr bnjbvr force-pushed the bnjbvr/migrate-ec-store-apis-for-threads branch from e8e66ea to 7fbb83e Compare June 9, 2025 09:26
@bnjbvr bnjbvr requested review from poljar and removed request for Hywan June 9, 2025 09:27
@codecov
Copy link

codecov bot commented Jun 9, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 28 lines in your changes missing coverage. Please review.

Project coverage is 85.05%. Comparing base (bdda4ab) to head (d92ef11).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...s/matrix-sdk-common/src/linked_chunk/relational.rs 84.50% 11 Missing ⚠️
crates/matrix-sdk/src/event_cache/room/mod.rs 60.71% 11 Missing ⚠️
crates/matrix-sdk-sqlite/src/event_cache_store.rs 92.15% 4 Missing ⚠️
...es/matrix-sdk-base/src/event_cache/store/traits.rs 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5182      +/-   ##
==========================================
- Coverage   85.09%   85.05%   -0.04%     
==========================================
  Files         328      328              
  Lines       36877    36943      +66     
==========================================
+ Hits        31381    31423      +42     
- Misses       5496     5520      +24     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bnjbvr bnjbvr mentioned this pull request Jun 9, 2025
4 tasks
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

I left a couple of nits. This looks mostly good.

I guess you'll squash merge this PR since individual commits don't build on their own?

My main gripe here is that we now have two things that are called a chunk identifier.

async fn handle_linked_chunk_updates(
&self,
room_id: &RoomId,
lcid: LinkedChunkId<'_>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this to chunk_id or linked_chunk_id like the rest of the patch does?

lcid is a bit opaque on first sight.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure!

@bnjbvr
Copy link
Member Author

bnjbvr commented Jun 9, 2025

Thanks for the review! Good point about the new dual ChunkId vs LinkedChunkId; probably we should rename one of these to something closer to linked list lingo. Not doing it in this PR here, we can discuss this as a group later.

@bnjbvr bnjbvr enabled auto-merge (squash) June 9, 2025 12:56
@bnjbvr bnjbvr merged commit ebcb74a into main Jun 9, 2025
42 of 43 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/migrate-ec-store-apis-for-threads branch June 9, 2025 13:26
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