-
Notifications
You must be signed in to change notification settings - Fork 375
IndexedDB: Add initial implementation of EventCacheStore
#5343
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
IndexedDB: Add initial implementation of EventCacheStore
#5343
Conversation
EventCacheStore
Hywan
left a comment
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.
Awesome. Just awesome. Well done!
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #5343 +/- ##
==========================================
- Coverage 88.77% 88.76% -0.01%
==========================================
Files 334 334
Lines 91086 91086
Branches 91086 91086
==========================================
- Hits 80860 80851 -9
- Misses 6387 6396 +9
Partials 3839 3839 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…odule Signed-off-by: Michael Goldenberg <[email protected]>
7752d32 to
f4cc0c7
Compare
Signed-off-by: Michael Goldenberg <[email protected]>
…ry store) Signed-off-by: Michael Goldenberg <[email protected]>
…d_chunk_updates Signed-off-by: Michael Goldenberg <[email protected]>
…e_linked_chunk_updates Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…all_chunks Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
f4cc0c7 to
a1f34a9
Compare
|
Oops! Forgot to autosquash when rebasing, so did it a second time! |
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). This particular pull request focuses on providing implementations of a fewEventCacheStorefunctions.Changes
The primary change is the addition of a top-level type,
IndexeddbEventCacheStore, as well as a way of constructing this type throughIndexeddbEventCacheStoreBuilder. Additionally,IndexeddbEventCacheStorealso provides an implementation ofEventCacheStore.In order to limit the size of this pull request, the implementation of
EventCacheStoreis almost entirely delegated to a nestedMemoryStoreexcept for the following two functions, which have a genuine IndexedDB implementation.EventCacheStore::handle_linked_chunk_updatesEventCacheStore::load_all_chunksAdditionally, there are a number of additions to
IndexeddbEventCacheStoreTransactionwhich support the implementation of theEventCacheStorefunctions above.get_chunk_by_idget_chunks_in_roomload_chunk_by_idadd_chunkdelete_chunk_by_iddelete_chunks_in_roomget_events_by_positionget_events_by_chunkput_eventdelete_events_by_positiondelete_event_by_positiondelete_events_by_chunkdelete_events_by_chunk_from_indexdelete_events_in_roomget_gap_by_iddelete_gap_by_iddelete_gaps_in_roomThese are mostly typed wrappers around the generic functions in
IndexeddbEventCacheStoreTransaction, though some of them add extra functionality as well.Tests
A quick note about the tests. Because most of the functions are delegated to a nested
MemoryStoreand only two are actually implemented, theevent_cache_store_integration_testsmacro will generate many failures. Consequently, I have made a local copy of the macro which only includes tests which are relevant toEventCacheStore::handle_linked_chunk_updatesandEventCacheStore::load_all_chunks. Once all functionality is added, this local macro will disappear and I will use the original one frommatrix_sdk_base.Additionally, there are a number of tests which have been copied and adapted from SQLite implementation of
EventCacheStore. Many of these tests will likely be generalized and included as part of theevent_cache_store_integration_testsmacro and will also, hopefully, disappear (see #5342).Future Work
EventCacheStorefunctions without relying onMemoryStore.Signed-off-by: Michael Goldenberg [email protected]