feat(sdk): Create ThreadEventCacheState#6280
Open
Hywan wants to merge 7 commits intomatrix-org:mainfrom
Open
Conversation
9 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6280 +/- ##
==========================================
- Coverage 89.91% 89.90% -0.02%
==========================================
Files 374 375 +1
Lines 102613 102703 +90
Branches 102613 102703 +90
==========================================
+ Hits 92267 92337 +70
- Misses 6783 6786 +3
- Partials 3563 3580 +17 ☔ View full report in Codecov by Sentry. |
581d2f8 to
9b67ac4
Compare
Hywan
added a commit
to Hywan/matrix-rust-sdk
that referenced
this pull request
Mar 13, 2026
This patch moves up the `has_new_gap` definition to clarify the code even more.
This patch creates `ThreadEventCacheInner` so that `ThreadEventCache` can be shallow cloned (which will be useful for `ThreadPagination`). That's also the first step to introduce `ThreadEventCacheState`!
This patch creates the `ThreadEventCacheState` type. It uses `caches::lock::StateLock`, just like `RoomEventCacheState`. It allows to have the `read()` and `write()` method to access the state, and to reload it when necessary, see the `caches::lock::Store` implementation. This patch thus creates `ThreadEventCacheStateLockReadGuard` and `ThreadEventCacheStateLockWriteGuard`. The methods touching the state in `ThreadEventCacheInner` are moved to these lock types. They are purely code moves (plus changes to reach the correct data): no change in the semantics.
This patch adds the `weak_room: WeakRoom` field to `ThreadEventCacheInner`. This is a prerequisite to have `ThreadPagination` uses `ThreadEventCacheInner` instead of `RoomEventCacheInner`!
…y `ThreadEventCacheInner`. This patch updates `ThreadPagination` to hold a `ThreadEventCacheInner` instead of a `RoomEventCacheInner`! It makes more sense and it splits/isolates the types even more. `RoomEventCache::thread_pagination` is now async and returns a `Result<ThreadPagination>` because it needs to load its state to fetch a `ThreadEventCache`. Later, accessing a thread wouldn't happen in `RoomEventCache` but in `Caches`, one step at a time.
22fea47 to
10e48e1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch updates
ThreadEventCacheto contain aThreadEventCacheInner. Then, it createsThreadEventCacheState(with no store support for the moment, but at least all the lock, reload and reset logic is here!). Finally it updatesThreadPaginationto own aThreadEventCacheInnerinstead of aRoomEventCacheInner(finally!).CHANGELOG.mdfiles.