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
Feat/632: support stream-channels query parameter when adding #633
Conversation
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This will only print the latest JSON update when adding with -Q. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
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.
Some minor comments,
Will review again once this PR is complete
fmt.Println(last.Cid) | ||
} else { | ||
formatResponse(c, *last, nil) | ||
} |
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.
The code that makes use of StreamChannels bool
flag is yet to be added, right?
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.
It's set to true by the DefaultParams() function. We won't add supports for stream-channels=false here for the moment (I think it might be enough for the requester with handling -Q
better).
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
Per review comment. License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
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.
OK Tested to be working well locally. Jenkins doesn't seem to be failing due to normal flaky tests, so let's fix that first.
@lanzafame actually when NOT passing |
@kishansagathiya seems the macos builder is not working well. will try another rebuild. |
@kishansagathiya Looks good to you? |
Passing
?stream-channels=true
will keep the current behaviour. TheAddedOutput
objects are streamed to the client as they happen.stream-channels=false
will, however, buffer all the addedOutput objects and return them as a final json array. Stream-related headers are adjusted accordingly.The
stream-channels
is used because that's what ipfs uses (even though go-ipfs does not respect it).The proxy /add will also acquire this feature.
Additionally, this modifies
ipfs-cluster-ctl add -Q
flag to apply as well when--enc=json
is provided. This means that, in this case, only the last json-formattedAddedOutput
object will be printed (before we ignored this flag in this case and printed everything). This should facilitate parsing the root hash result when usingipfs-cluster-ctl
by having valid json returned.(This PR does not add client support for
stream-channels=false
. Might do that in a different PR if necessary for #632 , but I suspect it might be enough with the -Q flag change).