-
Notifications
You must be signed in to change notification settings - Fork 23
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
Make private forest multivalue #78
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #78 +/- ##
==========================================
+ Coverage 64.56% 66.15% +1.58%
==========================================
Files 25 26 +1
Lines 1795 1873 +78
Branches 458 480 +22
==========================================
+ Hits 1159 1239 +80
- Misses 235 240 +5
+ Partials 401 394 -7
|
it's not in stable yet (CI). Also added a test
appcypher
reviewed
Oct 31, 2022
appcypher
approved these changes
Oct 31, 2022
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.
Looks good to me! 🎉
Only minor fixes to be addressed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR only changes the data format, but minimally changes the actual data stored. Specifically: We never actually generate multivalues in rs-wnfs. So why add support for them?
The reason is being future-proof: We know we'll make use of multivalues in the future, so we add support for them today, so that today's version of rs-wnfs will have some support for them even when future versions of rs-wnfs actually write multivalues.
In this PR:
PrivateForest
type alias changed to useBTreeSet<Cid>
as value, instead of justCid
PrivateForest.set
was renamed toput
, and it adds to the multivalues at a given key, instead of replacing. There's a performance optimization opportunity here to avoid walking the HAMT twice by creating amodify
/upsert
implementation inhamt/node.rs
. But that turned out to be quite some effort, so I'm postponing that for now.PrivateForest.get
now expects aresolve_bias
function parameter. Today that mostly ends up beingBTreeSet::first
, in order to fetch the smallest CID. That's the tie-breaking that's specified for WNFS by default, but that will be something different e.g. when we have previous pointers, then we'll bias towards those pointers.PrivateForest.get_encrypted
returns the wholeBTreeSet
now.PrivateForest
likeresolve_lowest
,resolve_single
andresolve_one_of
that are supposed to be helpers for use withPrivateForest.get
.Closes issue: #74