-
Notifications
You must be signed in to change notification settings - Fork 269
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): Add RoomPagination::run_backwards(…, until)
#3472
feat(sdk): Add RoomPagination::run_backwards(…, until)
#3472
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3472 +/- ##
==========================================
- Coverage 83.29% 83.28% -0.02%
==========================================
Files 248 248
Lines 25236 25243 +7
==========================================
+ Hits 21021 21024 +3
- Misses 4215 4219 +4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers! This may require a bit more testing…
This patch adds a new argument to `RoomPagination::run_backwards`: `until`. It becomes: pub async fn run_backwards<F, B, Fut>(&self, batch_size: u16, mut until: F ) -> Result<B> where F: FnMut(BackPaginationOutcome) -> Fut, Fut: Future<Output = ControlFlow<B, ()>>, The idea behind `until` is to run pagination _until_ `until` returns `ControlFlow::Break`, otherwise it continues paginating. This is useful is many scenearii (cf. the documentation). This is also and primarily the first step to stop adding events directly from the pagination, and starts adding events only and strictly only from `event_cache::RoomEventCacheUpdate` (again, see the `TODO` in the documentation). This is not done in this patch for the sake of ease of review.
This patch adds a new argument to the `until` argument closure of `RoomPagination::run_backwards`: `timeline_has_been_reset`, which designates when the timeline has been reset. A test has been updated accordingly.
This patch adds a test for `until` when it returns `ControlFlow::Continue` multiple times instead of `ControlFlow::Break` immediately.
bb0f598
to
7377971
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay
This didn't pass tests on CI, and it's been force-merged. Will revert because it was incorrectly merged. |
This patch adds a new argument to
RoomPagination::run_backwards
:until
. It becomes:The idea behind
until
is to run pagination untiluntil
returnsControlFlow::Break
, otherwise it continues paginating.This is useful is many scenearii (cf. the documentation). This is also and primarily the first step to stop adding events directly from the pagination, and starts adding events only and strictly only from
event_cache::RoomEventCacheUpdate
(again, see theTODO
in the documentation). This is not done in this patch for the sake of ease of review.EventCache
storage #3280