Skip to content
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

go-path integrated #8028

Merged
merged 9 commits into from Apr 24, 2021
Merged

go-path integrated #8028

merged 9 commits into from Apr 24, 2021

Conversation

acruikshank
Copy link

Motivation

We are integrating ipld-prime into IPFS starting with many of its dependencies. go-path has now been converted. This PR updates go-path to the ipld-prime (linksystem) version and makes a few modifications to accommodate that upgrade.

This PR depends on branches that are also in peer review and should not be merged until those upstream changes have been accepted, tag, and the dependencies in this PR are updated

@welcome
Copy link

welcome bot commented Mar 26, 2021

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

case "ipld":
resolveOnce = resolver.ResolveSingle
default:
if ipath.Segments()[0] != "ipfs" && ipath.Segments()[0] != "ipld" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: It would be nice if there were some const values for the segment indexes. If those do not already exist, that probably better in a separate future PR.

Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look OK to me. However, given the test failures it appears that sharded directory handling and a few other things are a problem. I do not know if that is something missing from this PR or needs to be fixed in a different PR.

@willscott
Copy link
Contributor

@hannahhoward - confirming this isn't 'in draft' and we should finalize review of use of unixfsnode and then merge this to target merge branch?

@hannahhoward hannahhoward marked this pull request as ready for review April 5, 2021 16:58
acruikshank and others added 5 commits April 5, 2021 11:59
License: MIT
Signed-off-by: hannahhoward <hannah@hannahhoward.net>
@aschmahmann
Copy link
Contributor

There's a sharness test failing, is this a known issue and are the deps here up to date?

Comment on lines 56 to 57
r := resolver.NewBasicResolver(api.blocks)
r.FetchConfig.NodeReifier = unixfsnode.Reify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is no big deal, but this seems to exactly match the Resolve function declared in core/node/core.go.

Was there a dependency issue or are we just copying the code bc it's only two lines?

@@ -6,20 +6,21 @@ package readonly
import (
"context"
"fmt"
"github.com/ipfs/go-cid"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's group the dependencies here and have separate groupings for builtins, fuse, ipfs+ipld

Comment on lines +81 to +93
// convert ipld-prime node to universal node
blk, err := s.Ipfs.Blockstore.Get(cidLnk.Cid)
if err != nil {
log.Debugf("fuse failed to retrieve block: %v: %s", cidLnk, err)
return nil, fuse.ENOENT
}

var fnd ipld.Node
switch cidLnk.Cid.Prefix().Codec {
case cid.DagProtobuf:
fnd, err = mdag.ProtoNodeConverter(blk, nd)
case cid.Raw:
fnd, err = mdag.RawNodeConverter(blk, nd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems confusing/bad in that it'll result in multiple blockstore fetches for the same data. Perhaps if the underlying datastore has caching this doesn't end up being so bad since we likely just fetched the data, but if this is a recurring pattern in the associated set of PRs here then we might need to make some changes.

I added some comments in the go-merkledag PR ipfs/go-merkledag#67

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aschmahmann I don't actually see those :( Can you point me to them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe you need to submit review or something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of the more general question -- it's a bit tricky. In IPLD Prime land, we don't always have a block to go with a node, cause nodes don't always match block boundaries. In a future pure IPLD Prime world, this isn't a problem -- we wouldn't load the block here, cause we wouldn't try to produce a legacy merkledag node, cause UnixFS would already work with prime nodes natively. However to convert back to legacy node, we have to do this. Hopefully, it's just a temporary step till we make more progress on go-ipld-prime conversion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of my comments seem to have disappeared, but this is the one I was thinking of ipfs/go-merkledag#67 (comment)

Comment on lines +96 to +100
return nil, fuse.ENOENT
}
if err != nil {
log.Error("could not convert protobuf node")
return nil, fuse.ENOENT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we switch these from fuse.ENOTSUP to fuse.ENOENT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a great question -- I didn't actually write this bit of code here (Alex C did but he's not working on PL stuff any more). Seems odd. I can change it back.

Comment on lines 89 to 90
rs := resolver.NewBasicResolver(bs)
rs.FetchConfig.NodeReifier = unixfsnode.Reify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern of initialization seems a little weird. I'll make some comments as I get to that part of the stack when reviewing 😄.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I think we should have a FetchConfig top level dependency in the DI stack, and pass it to NewBasicResolver rather than the block service. I think I've said this elsewhere as well.

cidLnk, ok := ndLnk.(cidlink.Link)
if !ok {
log.Debugf("non-cidlink returned from ResolvePath: %v", ndLnk)
return nil, fuse.ENOENT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fuse.ENOSUP might be more appropriate here. The thing exists we just don't know what to do with it.

License: MIT
Signed-off-by: hannahhoward <hannah@hannahhoward.net>
License: MIT
Signed-off-by: hannahhoward <hannah@hannahhoward.net>
Add fetcher config top level dependency
@hannahhoward hannahhoward merged commit 8d0ee3b into feat/ipld-in-ipfs Apr 24, 2021
@rvagg rvagg deleted the feat/update-ipld-go-path branch July 26, 2021 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants