-
-
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
object-patch: Support linking to non-dagpb objects #4460
Conversation
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Random fails on jenkins:
Got this one 3 times:
|
Yeah, I've seen that a few times recently. @vyzo? |
think it's related to the new pubsub code and changes that it brought? It really shouldn't affect normal resolutions. |
merkledag/utils/utils.go
Outdated
@@ -212,8 +212,9 @@ func copyDag(nd *dag.ProtoNode, from, to dag.DAGService) error { | |||
} | |||
|
|||
childpb, ok := child.(*dag.ProtoNode) | |||
if !ok { | |||
return dag.ErrNotProtobuf | |||
if !ok { // leaf node |
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.
I think this is a bit risky to do this way. Lets switch on the type, and then explicitly handle the ProtoNode and RawNodes. Then for everything else we can error out.
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.
Why not allow linking to other types? I actually need this to link to git commits, it works well for my usecase (ipld git helper). (note that it's already possible to do this with dag commands)
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 issue isnt that we don't want to allow linking, but that this operation is supposed to recursively copy a graph from one dagservice to another.
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.
@magik6k we can change the first argument of this function to accept a node.Node
, then skip this check entirely
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.
done
test/sharness/t0051-object.sh
Outdated
EMPTY_DIR=$(ipfs object new unixfs-dir) && | ||
OBJ=$(echo "123" | ipfs dag put) && | ||
N1=$(ipfs object patch $EMPTY_DIR add-link foo $OBJ) && | ||
ipfs object stat $N1 > /dev/null |
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 also test resolving the link, i.e. $N1/foo
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
No description provided.