-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
cmds/pin: use coreapi/pin #5843
Conversation
a39a699
to
07b7fc6
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.
Thanks! First pass, but looks fairly good.
a41cecd
to
31712ff
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.
After those 3 should be good
2d50260
to
2956bd0
Compare
There are some pin-related tests failing - https://ci.ipfs.team/blue/organizations/jenkins/IPFS%2Fgo-ipfs/detail/PR-5843/19/tests |
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.
Code looks good, not sure about the failing tests
Unfortunately, it looks like the commands library was duck-typing structs with an In the past, errors/non-errors were indistinguishable without duck-typing (in some cases). We've now fixed that so the client should only interpret something as an error if:
However, we're still ducktyping for backwards compatibility for the moment. |
d446d58
to
2956bd0
Compare
Ah, nevermind, that wasn't the issue. The issue is that the (I've removed my commit) |
53e260d
to
8d4de98
Compare
@magik6k @Stebalien |
The difference is that |
8d4de98
to
0c22e09
Compare
@Stebalien @magik6k All tests passed. Could u help me review it again? |
Let's wait for #5789 to avoid having to rework that. We should merge it within a few days. |
This is unblocked but will need a rebase. |
0c22e09
to
c7fd7b2
Compare
It`s ok. |
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.
We'll need discuss the --force
option a bit with the JS team (comments inline).
core/commands/pin.go
Outdated
return nil, err | ||
} | ||
|
||
if err := api.Pin().Add(ctx, p, options.Pin.Recursive(recursive)); err != 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.
This should use rp
, not p
. If we're using IPNS, there's a chance it may have changed.
core/commands/pin.go
Outdated
if err, ok := out.Error[k]; !ok { | ||
fmt.Fprintf(w, "unpinned %s\n", k) | ||
} else { | ||
fmt.Fprintf(os.Stderr, "cannot unpin %s: %s\n", k, err) |
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.
We can't do this in an encoder as encoders are sometimes run server-side. Instead, it should be handled by a PostRun. That is, you can setup a "CLI" PostRun that prints errors to standard error and forwards everything else to the encoder.
|
||
id := enc.Encode(rp.Cid()) | ||
pins = append(pins, id) | ||
if err := api.Pin().Rm(req.Context, rp, options.Pin.RmRecursive(recursive)); err != 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.
We need to discuss this with the JS team as well: https://github.com/ipfs/interface-ipfs-core/issues/127#issuecomment-456561650.
b10dd5b
to
03556a9
Compare
@Stebalien I think we can add (I had removed the |
SGTM. |
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
* Name them. Unfortunately, This makes the *actual* package names clear. I know this isn't "idiomatic go" but it's idiomatic go-ipfs. * Remove the duplicate import. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
03556a9
to
e2ab620
Compare
Related: #5717 (comment)
License: MIT
Signed-off-by: Overbool overbool.xu@gmail.com