-
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
Serve Car Files via Filecoin Retrieval Protocol #66
Conversation
add a module to serve car files over data transfer using retrieval vouchers
modify car supplier to serve blockstores, modify import handler to generate metadata, create end to end test
reinstate metadata and update sample car files
Codecov Report
@@ Coverage Diff @@
## main #66 +/- ##
==========================================
+ Coverage 37.84% 38.84% +0.99%
==========================================
Files 26 30 +4
Lines 1403 2003 +600
==========================================
+ Hits 531 778 +247
- Misses 807 1049 +242
- Partials 65 176 +111
Continue to review full report at Codecov.
|
6ecf006
to
fdd9113
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.
🚀
e2e_retrieve_test.go
Outdated
store := dssync.MutexWrap(datastore.NewMapDatastore()) | ||
blockStore := blockstore.NewBlockstore(store) | ||
lsys := storeutil.LinkSystemForBlockstore(blockStore) | ||
h, err := libp2p.New(context.Background(), libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/1")) |
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.
should this be /0
?
Looks like cbor-gen is being used for maps here, which has its own naive sorting, might not be a good idea (might also be a good chance to help push whyrusleeping/cbor-gen#56 over the line?). |
Thanks for the update. Did you write the schema file anywhere, so I can look into those? Or were you inferring the schema from the Go types alone, like cbor-gen? |
@rvagg we're going for 1:1 exact CBOR compatibility with go-fil-markets retrieval types, so things like switching from map encoding to list encoding is not an option. That said, if you want to advocate for pushing cbor-gen to do map ordering PR and use this as an example, happy to push on that. In the meantime they have to remain the same for wire compatibility. |
@mvdan there is, as you may have guessed, no schema. These are just the go types as defined by go-fil-markets and encoded with cbor-gen. However, I can give you the specific examples that will hopefully shed light on what's happening here. First, often in cbor-gen, pointer types are effectively used to encode optional fields (the obviously conflicts with go-ipld-prime that seperates optional and nullable... not may favorite aspect of the schema design). So for example PieceCID in a retrieval deal proposal is a pointer to a cid, meaning the field is essentially optional. I'd just be happy if we could convert those to nillable fields in a schema and have them work right. Second, you can see we use cbg.Deferred, a really weird type, for selectors. Basically selectors are ipld.Nodes, and I'd like to have a struct member for a selector that's an ipld.Node and then have a schema with type Any. I guess actually technically selectors have a schema so maybe we could just encode a type schema for them? In case you're wondering, cbg.Deferred is a really weird cbor-gen feature that basically saids "when you get to this field, don't decode it -- just read all the raw byte contents and put them in the field for later decoding" -- it results in some pretty weird code any time you generate retrieval proposals |
Goals
Setup the provider so it can serve car files to retrieval clients
Implementation
For discussion