-
Notifications
You must be signed in to change notification settings - Fork 213
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(iroh-bytes): Simplify store traits #2023
Conversation
(e.g. when ipv6 stun can't be sent)
PartialMap -> MapMut PartialEntry -> EntryMut
d9ea292
to
bee6d19
Compare
bee6d19
to
8ef2bc3
Compare
# Conflicts: # iroh-net/src/netcheck/reportgen.rs
8ef2bc3
to
ebd58f5
Compare
in particular clarify what a Map is.
for now this is an enum with a size and verified/unverified. In the future we might add more info to the unverified path, such as the max offset we have validated. But this info is not always available easily, so we don't for now. If you just want the size value, there is .value().
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.
👍 Nothing stood out to me, apart from the already resolved question of whether we want to use RPITIT - where I think I agree with rklaehn's reasoning above that you usually will need lots of boilerplate or boxing anyways. And the code reads much nicer with the impl Trait than with the associated traits. So: LGTM!
## Description Simplify and rename some store traits, taking advantage of return position impl trait in trait. The main change is that the map entries are no longer for one specific map impl, but just generic map entries, so the type parameter goes away. Other than that, the PartialXXX traits are renamed to XXXMut, which is more accurate. An immutable entry can be partial. Since MapEntry does not guarantee that it is complete (anymore), the main difference between MapEntry and MapEntryMut is not that the latter allows writing. Edit: one additional change is to introduce BaoBlobSize, which is a size together with an information about whether the size is validated or not. Why not just (u64, bool)? Because later we might add more info to the unverified enum case. ## Notes & open questions Note: this is not the end of it. Just trying to do this incrementally. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [ ] Tests if relevant.
Description
Simplify and rename some store traits, taking advantage of return position impl trait in trait.
The main change is that the map entries are no longer for one specific map impl, but just generic map entries, so the type parameter goes away. Other than that, the PartialXXX traits are renamed to XXXMut, which is more accurate. An immutable entry can be partial. Since MapEntry does not guarantee that it is complete (anymore), the main difference between MapEntry and MapEntryMut is not that the latter allows writing.
Edit: one additional change is to introduce BaoBlobSize, which is a size together with an information about whether the size is validated or not. Why not just (u64, bool)? Because later we might add more info to the unverified enum case.
Notes & open questions
Note: this is not the end of it. Just trying to do this incrementally.
Change checklist