Skip to content

IndexedDB: Add IndexedDB implementation of Event-related functions in EventCacheStore #5414

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mgoldenberg
Copy link
Contributor

@mgoldenberg mgoldenberg commented Jul 15, 2025

Background

This pull request is part of a series of pull requests to add a full IndexedDB implementation of the EventCacheStore (see #4617, #4996, #5090, #5138, #5226, #5274, #5343, #5384, #5406). This particular pull request focuses on providing implementations for the Event-related functions in EventCacheStore.

Changes

The changes include implementations of the following functions, as well as tests for each of them.

  • EventCacheStore::filter_duplicated_events
  • EventCacheStore::find_event
  • EventCacheStore::find_event_relations
  • EventCacheStore::save_event

I have also added a few other functions which support the implementation of the functions above.

  • IndexedEventRelationKey::set_related_event
  • IndexeddbEventCacheStoreTransaction::get_event_by_id
  • IndexeddbEventCacheStoreTransaction::get_events_by_relation
  • IndexeddbEventCacheStoreTransaction::get_events_by_related_event

Bug Fixes

There is also a small change to how Update::PushItems is handled. Namely, if a given item already exists in the database, it will update that item, rather than returning an error. The new behavior is consistent with the SQLite implementation of EventCacheStore (see here).

This bug was surfaced by matrix_sdk_base::event_cache::store::integration_tests::test_find_event_relations.

Future Work

  • Add implementation of EventCacheStore::try_take_leased_lock functions without relying on MemoryStore
  • Add implementation of EventCacheStoreMedia

  • Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg m@mgoldenberg.net

…r_duplicated_events

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…event

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…event

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
… item already exists

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…event_relations

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.83%. Comparing base (471e3c3) to head (783019e).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5414   +/-   ##
=======================================
  Coverage   88.83%   88.83%           
=======================================
  Files         334      334           
  Lines       91015    91015           
  Branches    91015    91015           
=======================================
+ Hits        80854    80857    +3     
+ Misses       6348     6345    -3     
  Partials     3813     3813           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mgoldenberg mgoldenberg marked this pull request as ready for review July 15, 2025 17:04
@mgoldenberg mgoldenberg requested a review from a team as a code owner July 15, 2025 17:04
@mgoldenberg mgoldenberg requested review from Hywan and removed request for a team July 15, 2025 17:04
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.

1 participant