-
Notifications
You must be signed in to change notification settings - Fork 375
IndexedDB: add functionality to get, add, replace, and remove media via MediaStore
#5682
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 functionality to get, add, replace, and remove media via MediaStore
#5682
Conversation
…e serialized value satisfies predicate Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…epoch Signed-off-by: Michael Goldenberg <[email protected]>
Signed-off-by: Michael Goldenberg <[email protected]>
…action type Signed-off-by: Michael Goldenberg <[email protected]>
…acing, and removing media Signed-off-by: Michael Goldenberg <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5682 +/- ##
=======================================
Coverage 88.37% 88.37%
=======================================
Files 355 355
Lines 97684 97684
Branches 97684 97684
=======================================
+ Hits 86328 86332 +4
+ Misses 7287 7283 -4
Partials 4069 4069 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #5682 will not alter performanceComparing Summary
|
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.
It looks good to me. Should we have a migration to handle the media_source to media_uri change?
I think it probably isn't necessary, given that none of this is exposed publicly outside the crate. I figure once everything is stabilized, we'll make it all public and then future changes will require migrations. What do you think? |
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.
Good to me! Thank you very much.
Background
This pull request is part of a series of pull requests to add a full IndexedDB implementation of the
EventCacheStoreandMediaStore(see #4617, #4996, #5090, #5138, #5226, #5274, #5343, #5384, #5406, #5414, #5497, #5506, #5540, #5574, #5603, #5676). This particular pull request adds IndexedDB-backed implementations for retrieving, storing, replacing, and removing media in IndexedDB viaMediaStore.Changes
IndexedDB implementations of top-level
MediaStorefunctionsThe overarching change is the addition of IndexedDB-backed implementations for the following functions.
MediaStore::add_media_contentMediaStore::replace_media_keyMediaStore::get_media_contentMediaStore::remove_media_contentMediaStore::get_media_content_for_uriMediaStore::remove_media_content_for_uriMediaStoreInner::add_media_content_innerMediaStoreInner::get_media_content_innerMediaStoreInner::get_media_content_for_uri_innerAdditionally, there were a number of changes that needed to be made in order to support the implementations above.
Index media object store by
MxcUrirather thanMediaSourcePrior to this pull request, the
MEDIAobject store contained an index that allowed querying byMediaSource; however, what was actually needed was to query byMxcUrigiven the expectations of the*_for_urifunctions above.So, the
MEDIA_SOURCEindex has been replaced with aMEDIA_URIindex, which allows querying by theMxcUriof the associated media.Add
UnixTimetype to better representMedia::last_accessIn order to better represent time relative to the Unix Epoch, the following type was added.
This type adds convenience as it is possible to convert a
SystemTimeto aUnixTimeinfallibly, given that it supports times before and after the Unix Epoch.Future Work
MediaStoreandMediaStoreInnerSigned-off-by: Michael Goldenberg [email protected]