-
Notifications
You must be signed in to change notification settings - Fork 166
[Pin Support][WIP] Adds required http endpoints for pinning support for rust ipfs #152
Conversation
@vmx Echoing the question above, are there any plans on including |
There are no plans, but I'm happy to take PRs adding that. |
@saresend In the meantime I've had good luck with the |
I think specifically its an interface concern. I'm not sure if the endpoint is expected to accept a |
Sorry for not giving you a proper intro to how these endpoints all work. So, I think it's time to introduce you to our good friend https://github.com/ipfs-rust/ipfs-rust-conformance :) This will tell you everything you need to know about what the HTTP endpoints should look like, and what the tests expect. It looks like, for example: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/pin/add.js expects a CID, but I'm sure the One thing you'll need to pay attention to is the tests themselves, some of them (including the one I linked above) use endpoints we haven't implemented yet, like Edit: please let me know how else I can help. happy to do so |
http/src/v0/pin.rs
Outdated
|
||
#[derive(Debug, Deserialize)] | ||
struct AddRequest { | ||
arg: Vec<Cid>, |
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.
Just as a small tactical heads up, the serde_urlencode
nor serde_qs
support these kind of arguments (multiple same names aggregated under a single type); the parsing has to be implemented manually at the moment as was for the https://github.com/ipfs-rust/rust-ipfs/blob/master/http/src/v0/refs/options.rs.
For serde_urlencode
I found some closed issue that this is out of scope. Having looked at it for a while, I don't think the serde implementation for this would be too easy or then I am just not understanding something of serde.
Doing this manually though, is quite simple. It also removes the need create remote wrappers for Cid, and so on, while being a bit non-idiomatic.
I'll also see what I can add to rs-ipfs/ipfs-rust-conformance#2 to help as well, and I'll likely move the ticket to One thing to note also is that if you can get pin/add working first (which you'll need to do anyway) and then PR that. block/rm needs it :) |
@saresend checking in before this gets too stale - do you think you'll have time to continue this effort? |
Oh so sorry, yeah let me update this and finalize sorry this totally fell off my radar! |
Alright, I think this should be good for http pin adding! Just wanted to ask about testing strategy, would you be expecting integration tests for all these sorts of endpoints, or are the unit tests internal to |
Thank you @saresend. We'll need to use https://github.com/rs-ipfs/ipfs-rust-conformance to check but that may be too much for a Friday night / weekend. By Monday at the latest I'll be able to write up some more instructions but in general you'll need to uncomment the line with the pinning tests in |
Ah, crap. Looks like we have the same issue with all the other tests where the tests for @achingbrain and @hugomrdias get ready for some more |
@saresend I'm working now on updating the conformance tests and also refactoring the underling First, set up the branch of
Then, set up
See the README from If all goes well, you should see what I see, which is something like:
Thanks for tackling this. I think you've made some great progress and the conformance tests will guide you furher. PS. I see the checkboxes in the description of this PR. Do you still plan on adding pin/rm and pin/ls? I hope so 🤞 😄 |
What
Addresses the http side #11
Reference here: https://docs-beta.ipfs.io/reference/http/api/#api-v0-pin-add
Thoughts and Comments
Admittedly I'm not super super familiar with exactly the distinction, but I wanted to pitch including
Serialize
andDeserialize
support for theCid
type, so that way we can use that directly instead of usingMultiaddr
at the endpoint level. Alternately we can just try casting fromMultiaddr
toCid
, so if that's the superior approach please let me know.Furthermore, at least for add there is a request for a
Progress
response, which I'm not entirely sure how to handle here, or even what it represents. I imagine it may have something to do with when recursive pinning support lands, and so right now it just returns 100%.Todos