Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

feat: subtree support #175

Merged
merged 14 commits into from
Jun 16, 2017
Merged

feat: subtree support #175

merged 14 commits into from
Jun 16, 2017

Conversation

daviddias
Copy link
Contributor

@daviddias daviddias commented Jun 3, 2017

WIP

@daviddias daviddias added the status/in-progress In progress label Jun 3, 2017
@pgte
Copy link
Contributor

pgte commented Jun 14, 2017

@diasdavid to support your last point (resolving from non-pb nodes), I had to implement a resolver for "unknown" file types.

Could you please take a look at https://github.com/ipfs/js-ipfs-unixfs-engine/blob/b446b0d219f902173c0ef389392a7e95c0fa1b59/src/exporter/unknown.js and see if there would be a better way of doing this?

@daviddias
Copy link
Contributor Author

@pgte what is the logical difference between:

  • /QmHashDAGPB/a/b/c.txt
  • /QmHashDAGCBOR/a/b/c.txt

In terms of resolving? It should agnostically use the IPLD Resolver to traverse to the file and export it, correct?

Can you also make sure with tests the expected behaviour in js-ipfs is respected, namely:
image

(it might be already, I haven't checked)

@pgte
Copy link
Contributor

pgte commented Jun 15, 2017

@diasdavid the problem I found by trying to use the ipldResolver to try to resolve the whole path is that it hangs indefinitely when provided a path on the second argument of .get. I presume because it isn't able to resolve the whole path through IPLD, since IPLD doesn't speak "UnixFS".

I was hoping that the IPLD resolver would quit at the time it entered UnixFS territory and just return me the remainder path, but that hasn't happened..

Bug or am I using this wrong?

@pgte
Copy link
Contributor

pgte commented Jun 15, 2017

@pgte
Copy link
Contributor

pgte commented Jun 15, 2017

Having said that, with the exception of sharded dirs (where the link names do not correspond to dir entries), it should map pretty well though.. Any thoughts?

@daviddias
Copy link
Contributor Author

daviddias commented Jun 16, 2017

I found by trying to use the ipldResolver to try to resolve the whole path is that it hangs indefinitely when provided a path on the second argument of .get. I presume because it isn't able to resolve the whole path through IPLD, since IPLD doesn't speak "UnixFS

Got it! Yeah, that is definitely the issue, it doesn't speak UnixFS so that paths don't map directly. Makes sense to have that unknown exporter. Could use a better name then, subTreeExporter?

Having said that, with the exception of sharded dirs

Now I'm unclear, you already got support for shared dirs, right? Using the UnknownExporter

#175 (comment)

Did you verify if you reproduce exactly the above with js-ipfs now?

@pgte
Copy link
Contributor

pgte commented Jun 16, 2017

@diasdavid paths into shared dirs is supported in this branch, but in theory, not natively by resolving through IPLD (because the link names are prefixed with the shard bucket number).

@pgte
Copy link
Contributor

pgte commented Jun 16, 2017

@diasdavid regarding the IPLD resolver not being able to resolve up until the file protobuf, I think we can live with it for now, since I'm resolving "by hand". I'll open an issue to solve this later.

@pgte
Copy link
Contributor

pgte commented Jun 16, 2017

@diasdavid other than that, I think this feature is ready to be merged.

@daviddias
Copy link
Contributor Author

@diasdavid paths into shared dirs is supported in this branch, but in theory, not natively by resolving through IPLD (because the link names are prefixed with the shard bucket number).

That's the desired behavior

What about #175 (comment), did you npm link in js-ipfs and checked?

@pgte
Copy link
Contributor

pgte commented Jun 16, 2017

Looks like it works:

1__bash

@daviddias
Copy link
Contributor Author

@pgte exactly, not the different between #175 (comment) and #175 (comment). go-ipfs doesn't preserve the whole path when fetching a subtree, just the file name.

@pgte
Copy link
Contributor

pgte commented Jun 16, 2017

@diasdavid subtree path preserved, just like in go, given by 8dcdac6.

@daviddias
Copy link
Contributor Author

awesome! :D

@daviddias daviddias removed the status/in-progress In progress label Jun 16, 2017
@daviddias daviddias deleted the feat/subtrees branch June 16, 2017 16:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants