-
Notifications
You must be signed in to change notification settings - Fork 262
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
event cache: add a way to get an event by ID #3682
Conversation
838087f
to
4f19836
Compare
@@ -196,6 +196,24 @@ impl EventCache { | |||
Ok(()) | |||
} | |||
|
|||
/// Try to find an event by id in all the rooms. |
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.
Perhaps we should clarify by which ID, if you don't like this form perhaps spelling out the term "event ID" would be better?
/// Try to find an event by id in all the rooms. | |
/// Try to find an event by its ID in all the rooms. |
/// Try to find an event by id in all the rooms. | ||
/// | ||
/// Note: this does a linear scan, so it could be slow. If performance | ||
/// requires it, using a direct mapping of event id -> event might be |
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.
Does this tell the user that they should create such a mapping or that we, the developers, will provide it if this method turns out to be slow?
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.
You're right, it's unclear. We should do that, if needs be; i'll convert this into a code non-doc comment.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3682 +/- ##
==========================================
+ Coverage 84.32% 84.36% +0.04%
==========================================
Files 258 258
Lines 26614 26615 +1
==========================================
+ Hits 22441 22455 +14
+ Misses 4173 4160 -13 ☔ View full report in Codecov by Sentry. |
4f19836
to
d96c72a
Compare
"dude… what if the event cache… allowed to retrieve events by id… i know, it's crazy right…"
This is going to be useful for #3663, for edits we'll want to retrieve the original event by id, to see if it was a reply, and some other things like this.
Part of #3058 too.