-
Notifications
You must be signed in to change notification settings - Fork 299
add support for ipfs files stat --with-local #695
Conversation
If the best choice is to adjust go-ipfs, it would be nice to choose before the upcoming 0.4.14. |
Someone to answer my question ? |
What are the values missing? Mind updating that with the docs + tests on https://github.com/ipfs/interface-ipfs-core ?
The endpoint should be setting the headers so that js-ipfs-api figures that on the fly. Is that not the case? |
New values comes from ipfs/kubo#4638. I will update interface-ipfs-core as well.
Actually, I'm not really sure what's going on. This is what I get when I do a request with the last go-ipfs: Here, |
@MichaelMure I had a problem which was similar, though after a quick look at the stats source I think I was triggering a different code path. Nonetheless it might be worth to check. Could you set a breakpoint at https://github.com/ipfs/js-ipfs-api/blob/f81dce5bf54df3a3578e4786bfb741d761cd1297/src/utils/send-files-stream.js#L135 and see if you come across it? If yes, then it might be related to #696. Another hack that worked in my case when I didn't get any value back from a stream was hard-coding the |
The breakpoint at https://github.com/ipfs/js-ipfs-api/blob/f81dce5bf54df3a3578e4786bfb741d761cd1297/src/utils/send-files-stream.js#L135 is not triggered. Hardcoding The root problem might linked to 210dabb that introduce changes on how data is decoded when |
@pgte There seem to be more issues with streamed responses. |
@diasdavid does that make sense for you to set the optional values of the http request to default value as I did in this PR ? Or should the keys be missing entirely ? For reference, the go struct: type statOutput struct {
Hash string
Size uint64
CumulativeSize uint64
Blocks int
Type string
WithLocality bool `json:",omitempty"`
Local bool `json:",omitempty"`
SizeLocal uint64 `json:",omitempty"`
} |
@diasdavid spec completed here: ipfs-inactive/interface-js-ipfs-core#227 |
PR updated with better default values and a fixed test |
I see you did it already. I'll check your PR on interface-ipfs-core and see if everything is passing and then I'll leave my review here 😄 |
@MichaelMure curiously enough, the tests passed here. Anyway, I'm approving this changes because they seem to be correct. We can wait until those issues are also fixed to merge this one. |
So, huuuu, I actually had trouble when the http reply was a stream because I ... didn't unwrap the stream with I still have trouble running the tests properly (lots of unrelated tests are failing), so I'm not sure everything is correct. That said I'm currently using a fork of js-ipfs-api in my project (https://github.com/MichaelMure/js-ipfs-api/tree/fork) and it works properly now. |
@MichaelMure released interface-ipfs-core with your changes, please rebase master onto this branch and update the interface-ipfs-core dep to 0.56.0. |
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.
Merging for #713
So, I upgraded my js-ipfs-api and found out that the support for
ipfs files stat --with-local
was broken after 98000af (the response object is not relayed entirely anymore, so the new values get dropped).Another problem I had and that is not solved yet by this PR is that due to the migration in go-ipfs to the new
go-ipfs-cmds
framework (ipfs/kubo#4638), the commandipfs files stat
now reply with a stream which is not converted properly in values by js-ipfs-api. There is two way to solve that problem:cmds.EmitOnce
in go-ipfs to hint the ReponseEmitter and reply without streamingDo you have a preference ?
CC @whyrusleeping, @Stebalien