-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Remove usage of merkledag.Link.Node pointer outside of merkledag #1916
Conversation
From there, we might want to split the
The data flow would be different. Instead of decoding everything of the IPLD node in a generic and unoptimized data structure (recursive maps basically), we could get both a non decoded data structure (the The drawback of this approach is that we could not directly encode the optimized data structure back to the wire format (JSON, CBOR or ProtoBuf) because we would lose the bits we didn't decode first. This would apply only to modifying existing nodes, not to creating new nodes. @whyrusleeping this might explain a bit of the discussion we had in ipld/go-ipld-deprecated#14 |
764bef9
to
1bbc472
Compare
@mildred needs a rebase |
There were the following issues with your Pull Request
Guidelines and a script are available to help. Your feedback on GitCop is welcome on this issue. This message was auto-generated by https://gitcop.com |
@@ -78,12 +78,13 @@ it contains, with the following format: | |||
Links: make([]LsLink, len(dagnode.Links)), | |||
} | |||
for j, link := range dagnode.Links { | |||
link.Node, err = link.GetNode(req.Context(), node.DAG) | |||
var linkNode *merkledag.Node | |||
linkNode, err = link.GetNode(req.Context(), node.DAG) |
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.
keep it as one line, using the :=
instead of a var declaration.
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 didn't want to override the err
variable. using :=
is not equivalent because it creates a new err
variable scoped in the for
loop.
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 fail to see the reason for reusing the err var here:
if an err happens inside the loop, the function returns right away, and if the loop is done, it means the err is nil
-- same behavior for both reused / scoped errs.
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.
yeah, theres no reason not to create a new err
in the inner scope. thats what we want to do.
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.
reusing err values across scopes causes a lot of errors, has bitten us in the past already
See also ipld/go-ipld-deprecated#17 which is where I'd like to go next to fit IPLD within IPFS in terms of API. |
68b9745
to
b0a8591
Compare
License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
cf514d8
to
3224ae0
Compare
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
See ipfs#1296 License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
Need to publish to https://github.com/ipfs/npm-go-ipfs cc @whyrusleeping this did not happen for 0.3.11
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
combine multiple bootstrap addrs into single peer info
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
docs: improve windows.md
Do not install gx if user explicitly didn't ask for it
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
add a pause to fix timing on t0065
Capitalized Merkle, added single quotes, periods
Normalised Example heading, added dollar sign to examples
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@gmail.com>
Add information about installing gx into readme
License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
See @dignifiedquire comments in ipfs-inactive/http-api-spec#45 License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
License: MIT Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
Capped IPFS, added period
Removed double space, hyphen
Fixed spelling error
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
fix panic in cli arg parsing
This prepares for inclusion of IPLD where the Node pointer won't be there. License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
This function work only with protocol buffer encoding. To make this clear, rename the function. License: MIT Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
Just to be sure, you asked me to rebase on That's why we see all the commits here. |
These days there are some v0.4.0 related tags on master. It looks like the last one is v0.4.0-rc2, so there should not be a big difference and I think it's better to rebase on master. |
Closed in favor of #2359 |
This prepares for inclusion of IPLD where the Node pointer might not be publicly accessible of even be there. We should probably move away from using the struct attributes and use functions to access them instead. This will make it easier to plug in IPLD in place of merkledag.
Obsoletes #1902 (PR on the wrong branch, and this can't be changed)
see also discussion in ipld/go-ipld-deprecated#14