-
Notifications
You must be signed in to change notification settings - Fork 375
IndexedDB: Add initial implementation of EventCacheStore
#5090
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
#5090
Conversation
…dule Signed-off-by: Michael Goldenberg <[email protected]>
…ogic Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…tCacheStoreError Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
…s in event cache store backend Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
…ized values have an `id` field Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
…_chunk_updates Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
…m_chunks Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
…ed_lock Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
… cache store Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]> Co-authored-by: Oscar Franco <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…_chunk Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…nt cache store Signed-off-by: Michael Goldenberg <[email protected]>
…ated_events Signed-off-by: Michael Goldenberg <[email protected]>
…lations Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…heStore::find_event Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
… chunks Signed-off-by: Michael Goldenberg <[email protected]>
…ache store Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
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.
Oh wow, it looks great! Thanks for the hardwork.
First off, is it possible to split this PR in smaller ones? It would radically simplify the review process, both for you and for me? Feel free to assign me for all the PR.
I could certainly try, but it’d be helpful to hear any suggestions as to what would make things easier for you! For context, it was hard to keep things small as the trait is quite large 😬 but if you’re okay with partial implementations of the trait, failing tests, etc I could probably split it up further to add one function at a time. Let me know what you think! |
|
Also, I did my best to add one function per commit, so that may be useful to you in review? |
|
I think we can split the PR as follows:
What do you think? |
|
@Hywan, I think that would mostly work okay, except that the integration tests cannot be added incrementally as far as I can tell. I suppose I could copy relevant tests over one-by-one, and then when we have all the functions implemented, I could remove the copies and make a call to the macro. Does that sound reasonable? Or is there a better way of going about that? |
|
I might also be able to delegate to a nested |
It sounds great to me! |
|
Closing this, as work is continuing piecemeal in #5138. |
Background
This pull request provides an initial implementation of the
EventCacheStoreand is mostly taken from the work completed in #4617, with a few additions and modifications to accommodate more recent updates to the trait.Given that #4617 was a rather large pull request, this is part of a series of pull requests which will break that work into smaller, more manageable changes (see #4996). Notably, to minimize changes, this pull request omits the implementation of
EventCacheStoreMediaand simply uses a nestedMemoryStorefor media queries for the time being.Changes
This change is focused on integrating the implementation of
EventCacheStorefrom #4617, while using a nestedMemoryStorefor media queries. Additionally, since the original implementation was written before the latest version of theEventCacheStore, I have added implementations of new functions.There are virtually no changes to existing code, except for the addition of a new feature -
event-cache-store- to thematrix-sdk-indexeddbcrate. Most other changes occur in entirely new files.Caveats
Given that the original implementation from #4617 was written before some of the more recent additions to the
EventCacheStoretrait, I had to retrofit implementations for a number of functions which are rather inefficient. I have left them inefficient, however, in order to keep this pull request small, as the changes are a bit involved.I plan to improve them in a follow-up pull request.
Finding the Last Chunk
Loading the last chunk in a list - i.e.,
EventCacheStore::load_last_chunk- currently reads in and deserializes all chunks in a room and looks for any that have nonextvalue. This is a rather inefficient process and could be greatly improved by adding another index on theLINKED_CHUNKSobject store.Querying Events by ID
The following functions read and deserialize all events in a room in order to perform their operations.
EventCacheStore::filter_duplicated_eventsEventCacheStore::find_eventEventCacheStore::find_event_relationsEventCacheStore::save_eventThese operations could also be greatly improved by the addition of a few new indices on the
EVENTSobject store.Future Work
LINKED_CHUNKSobject store in order to improve chunk-related queries.EVENTSobject store in order to improve event-related queries.EventCacheStoreMediaimplementation in order to have persistent media storage.Signed-off-by: Michael Goldenberg [email protected]