-
Notifications
You must be signed in to change notification settings - Fork 83
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
refactor: use BaseWallet instead of a specific wallet type #1122
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1122 +/- ##
========================================
- Coverage 0.05% 0.05% -0.01%
========================================
Files 499 506 +7
Lines 25018 25477 +459
Branches 4520 4635 +115
========================================
Hits 13 13
- Misses 25005 25464 +459
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
b500b4d
to
21162fc
Compare
2f5be37
to
d54fdf7
Compare
|
||
async fn unpack_message(&self, msg: &[u8]) -> VcxCoreResult<UnpackMessageOutput>; | ||
async fn all(&self) -> VcxCoreResult<Box<dyn AllRecords + Send>>; |
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 custom trait instead of simply implementing an iterator? Why on BaseWallet
instead of RecordWallet
?
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.
Because I need a custom abstraction for how different wallet implementations fetch all records. vdrtools wallet provides WalletIterator which does not conform to std::iter::Iterator
nor to std::async_iter::AsyncIterator
.
Moved to RecordWallet
.
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 asked why it's implemented on BaseWallet
instead of RecordWallet
, I am not arguing for moving it (or not).
Also, I still don't understand why a new, wallet specific, trait was created instead of just implementing an iterator.
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.
RecordWallet
operates only on records, so it was implemented in BaseWallet
because it fetches both records and keys. Even though keys are "key records" since everything is stored in the same table. Indy wallet fetches everything with a single method while askar has separate methods for keys and records.
Instead of just implementing an iterator, a wallet specific trait was created because
getting all records for indy gives me WalletIterator which is async and I do not see a way how to implement a sync trait using async function.
I could implement async iterator but that requires bringing in additional dependency.
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.
IndyTags
don't need to be pub(crate)
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.
@xprazak2 if this is still true, let's mininize the visibility.
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.
If I make them private, how can they be used in indy_record_wallet.rs
?
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 am not sure, but I think what I meant when posting this comment 3 weeks ago was just that the (crate)
modifier was unnecessary as the module is private anyways.
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.
Changed.
72ad926
to
4fc6053
Compare
Things that will need to be addressed in the future:
|
6c77fbb
to
e03f1f4
Compare
0d90aff
to
dd8ae2b
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.
Left a review, I am mostly concerned about usage of trait objects
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.
@xprazak2 if this is still true, let's mininize the visibility.
a54387a
to
c009c9a
Compare
The dynamic dispatch is no longer used. |
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.
LGTM ✅ Great job @xprazak2 this is good improvement
Replaces the direct usage of
IndySdkWallet
withBaseWallet
trait.