-
Notifications
You must be signed in to change notification settings - Fork 17
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
Graphsync v2.0: bindnode conversions for vouchers #305
Conversation
The goal here should be to get Vouchers and VoucherResults to be generic datamodel.Nodes or schema.TypedNode and pushing the wrapping in bindnode up to the library consumer. We already discussed but just want to serialize that direction. |
Interesting direction this is taking. I notice this deserialization of vouchers into anything but basicnode.Any out of the library. This wasn't quite how I envisioned this. I had imagined that we still pass the vouchers to the Also perhaps it makes sense to seperate out registering a mapping of TypeIdentifier -> NodePrototype from TypeIdentifier -> Validator / Revalidator? I think this would make sense. This is shaping up to be a big breaking change -- it's the right direction, but I wonder if we say #304 is the boundary for the next release. There's no network changes underlying all this, so we can always do this later right? |
Codecov Report
@@ Coverage Diff @@
## feat/graphsync-20-minimal #305 +/- ##
=============================================================
+ Coverage 66.89% 73.02% +6.12%
=============================================================
Files 24 21 -3
Lines 3169 2654 -515
=============================================================
- Hits 2120 1938 -182
+ Misses 708 524 -184
+ Partials 341 192 -149
Continue to review full report at Codecov.
|
fffca3e
to
42ad177
Compare
42ad177
to
0c6a14a
Compare
After discussion, we've gone with just a plain I've done some cleanup, added some more tests and fixed up the README. I hope this is good to go now. But it's not going to be a painless upgrade for downstream users who now have to deal in One unresolved item that may need adjusting: type Voucher ipld.Node
type VoucherResult ipld.Node Then the interface deals in both |
0c6a14a
to
e9a2a7d
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.
So this is pretty close BUT...
ipldutil usage is still off I think from what I was intending I think.
You have:
- gotten rid of RegisterVoucherResultType
- made all the register methods take a type parameter instead of a type
- made a registry of node prototype -> but keys must be go type names and explicity require the use of bind node
- still generally using any to construct nodes for vouchers though
I believe you need:
- a registry, in go-data-transfer manager, that is a mapping of TypeIdentifier -> generic node prototype
- a new function to register prototypes say `RegisterVoucherPrototype(name TypeIdentifier, prototype datamodel.NodePrototype)
- when calling functions like NodeFromDagCBOR, lot for a prototype in the registry, use that to generate a NodeBuilder for dagcbor.Decode (still feature detect and use representation prototype as needed). Probably means they are part of manager as opposed to pure functions.
This new register type would replace RegisterVoucherResultType AND the part of RegisterVoucherType that just about making a map of type identifier -> used node prototype.
e9a2a7d
to
c79ac4d
Compare
675429f
to
c1910fa
Compare
Some time has passed since this work was done and discussion was had but my recollection of the discussion that happened after the last comment was that we were going to try going ahead with this current approach and see how well it works downstream. We've pushed all IPLD schema work out to consumers, just passing around generic, untyped I may be wrong on that recollection, it wouldn't be the first time. Current plan is to try this out on go-fil-markets. This branch is now directly on top of current |
this is now impossible to rebase against |
Early WIP,
ipldbind
package in here is probably the most interesting, replacing theencoding
package's functionality for vouchers.