-
Notifications
You must be signed in to change notification settings - Fork 303
feat(wasm): add feature support for indexedb and sqlite to matrix-sdk-ffi #5245
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
base: main
Are you sure you want to change the base?
Conversation
Waiting on #5211 to be merged before reviewing this one. |
Would be nice to get opinions on the new session_store and client_builder changes. Those are wholly new, and structural feedback would be very welcome |
Can this one be rebased as well? |
eacaec7
to
f431d9a
Compare
Yep, rebased it to adopt the Cargo.toml changes. This PR now concerns only the configuration of the session store. Let me know if a different approach would be preferred here, adding sub-builders seemed more self-documenting than having a large number of 'optional' methods on the main builder, but happy to do it a different way if you prefer. |
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 #5245 +/- ##
=======================================
Coverage 90.18% 90.18%
=======================================
Files 334 334
Lines 104822 104822
Branches 104822 104822
=======================================
+ Hits 94534 94538 +4
+ Misses 6236 6232 -4
Partials 4052 4052 ☔ View full report in Codecov by Sentry. |
Here is a corresponding complement-crypto PR: matrix-org/complement-crypto#195 |
7ac8f7c
to
474eb29
Compare
The system of platform targets was already quite messy, and becoming even worse as we start preparing for Wasm support. Switch to features instead to make this easier to work with.
474eb29
to
fe98e31
Compare
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.
Thanks for the patches. The general idea is good, but the patches deserve more work.
@@ -231,7 +231,7 @@ fn check_clippy() -> Result<()> { | |||
"rustup run {NIGHTLY} cargo clippy --workspace --all-targets | |||
--exclude matrix-sdk-crypto --exclude xtask | |||
--no-default-features | |||
--features native-tls,sso-login,testing | |||
--features native-tls,sso-login,sqlite,testing |
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.
The same patch is mixing two things. Proof is your commit message contains “and”.
Please split this patch into two.
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.
By the way, this change should be a fixup of the patch introducing the sqlite
feature.
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 is not mixing two different things, it is adding support for indexedb which requires parameterizing the sqlite configuration. I do not believe these are separable changes.
@@ -55,15 +55,15 @@ mod sqlite_session_store { | |||
/// capable of handling multiple users, however it is valid to use the | |||
/// same path for both stores on a single session. | |||
#[uniffi::constructor] | |||
pub fn new(data_path: String, cache_path: String) -> Self { | |||
Self { | |||
pub fn new(data_path: String, cache_path: String) -> Arc<Self> { |
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.
Why?
It should be a fixup patch.
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.
I don't know what that means. What is a fixup patch?
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.
A fixup patch is a patch that is “melt”/“merged” with another one so that we end up with a single patch, see https://git-scm.com/docs/git-rebase.
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.
The contributing guide also explains it: https://github.com/matrix-org/matrix-rust-sdk/blob/main/CONTRIBUTING.md#addressing-review-comments-using-fixup-commits.
use std::sync::Arc; | ||
|
||
use super::SessionStoreResult; | ||
use crate::{client_builder::ClientBuildError, helpers::unwrap_or_clone_arc}; | ||
|
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.
A fixup patch.
Co-authored-by: Ivan Enderlin <[email protected]> Signed-off-by: Daniel Salinas <[email protected]>
Co-authored-by: Ivan Enderlin <[email protected]> Signed-off-by: Daniel Salinas <[email protected]>
Co-authored-by: Ivan Enderlin <[email protected]> Signed-off-by: Daniel Salinas <[email protected]>
Co-authored-by: Ivan Enderlin <[email protected]> Signed-off-by: Daniel Salinas <[email protected]>
Expose a choice of session storage in the matrix-sdk-ffi crate. The initial choices are Sqlite (supported on non-Wasm platforms) and IndexedDb (Wasm only). It was agreed though that feature flags make more sense here, and make the code more maintainable.
The existing bundled-sqlite is setup to opt-in sqlite, however several methods for configuring a Sqlite store have been moved onto a sub-builder for organizational reasons.
This PR is stacked on top of https://github.com/matrix-org/matrix-rust-sdk/pull/5211/files, I will rebase it against main when that has landed.
Corresponding PR for complement-crypto: matrix-org/complement-crypto#195
Signed-off-by: Daniel Salinas