Skip to content
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

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jul 10, 2024

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

@bnjbvr bnjbvr requested a review from a team as a code owner July 10, 2024 14:56
@bnjbvr bnjbvr requested review from poljar and removed request for a team July 10, 2024 14:56
@bnjbvr bnjbvr force-pushed the bnjbvr/event-cache-find-event-by-id branch from 838087f to 4f19836 Compare July 10, 2024 15:04
@@ -196,6 +196,24 @@ impl EventCache {
Ok(())
}

/// Try to find an event by id in all the rooms.
Copy link
Contributor

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?

Suggested change
/// 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
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.36%. Comparing base (847bf5b) to head (d96c72a).
Report is 10 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@bnjbvr bnjbvr force-pushed the bnjbvr/event-cache-find-event-by-id branch from 4f19836 to d96c72a Compare July 10, 2024 15:24
@bnjbvr bnjbvr enabled auto-merge (rebase) July 10, 2024 15:24
@bnjbvr bnjbvr merged commit 6ee2919 into main Jul 10, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/event-cache-find-event-by-id branch July 10, 2024 15:43
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