-
Notifications
You must be signed in to change notification settings - Fork 258
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(event cache): sqlite persistent storage for the event cache 😎 #4308
Draft
bnjbvr
wants to merge
18
commits into
main
Choose a base branch
from
bnjbvr/sqlite-event-cache
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
bnjbvr
force-pushed
the
bnjbvr/sqlite-event-cache
branch
from
November 21, 2024 17:21
4fc22de
to
ddbfc98
Compare
This was referenced Nov 25, 2024
bnjbvr
force-pushed
the
bnjbvr/sqlite-event-cache
branch
from
November 26, 2024 15:17
ddbfc98
to
9a452bd
Compare
bnjbvr
force-pushed
the
bnjbvr/sqlite-event-cache
branch
from
November 27, 2024 13:44
9a452bd
to
baafadc
Compare
For what it's worth, to observers of this PR: this is being split, redesigned and reviewed in several smaller PRs, which all link to this one. This PR might be repurposed to represent the final step of the work done here, at some point. |
And make it a smoke test that the event cache correctly gets events it retrieves from sync.
…nd event cache storage
…_initial_items` Moar MatrixMockServer \o/
… storage has been enabled Not worth testing IMO, since this is about the "temporary" API we're going to remove in subsequent patches.
…n storage's enabled
And fix an issue that would cause a crash because a timeline wasn't initialized and we tried to unwrap it later.
…ys return `true`. The `add_or_update_remote_event` method always returns `true`. This patch updates the method to return nothing, and cleans up the call sites accordingly. This patch also adds comments to clarify the code flow. The bool value returned by `add_or_update_remote_event` was supposed to be `false` if the event was duplicated. First off, as soon as the `Timeline` receives its events from the `EventCache` via `VectorDiff`, the `event_cache::Deduplicator` will take care of deduplication, so the `Timeline` won't have to handle that itself. Second, `add_or_update_remote_event` was sometimes removing an event, but it was re-inserting a new one immediately without returning `false`: it was never returning `false` because a new event was always added.
This patch replaces `VecDeque<EventMeta>` by `AllRemoteEvents` which is a wrapper type around `VecDeque<EventMeta>`, but this new type aims at adding semantics API rather than a generic API. It also helps to isolate the use of these values and to know precisely when and how they are used. As a first step, `AllRemoteEvents` implements a generic API to not break the existing code. Next patches will revisit that a little bit step by step.
This patch renames `AllRemoteEvents::back` to `last` so that it now gets a specific semantics instead of being generic.
Having a mutable iterator can be dangerous and is probably too generic regarding the safety we want to add around the `AllRemoteEvents` type. This patch removes `iter_mut` and replaces it by its only use case: `get_by_event_id_mut`.
…e::Room` This was only used to retrieve events cached in the timeline_queue().
bnjbvr
force-pushed
the
bnjbvr/sqlite-event-cache
branch
from
December 3, 2024 16:04
baafadc
to
cfc0aff
Compare
bnjbvr
force-pushed
the
bnjbvr/sqlite-event-cache
branch
from
December 3, 2024 16:18
374a421
to
1473d60
Compare
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 implements the following parts of #3280 (comment):
For getting a nice demo in the
multiverse
client, a few shortcuts have been taken in the last commit, but these should be relatively easy to solve.The demo shows the following:
Screencast.From.2024-11-21.18-09-05.mp4
More to come next week.