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

wrap permanence #1663

Closed
reit-c opened this issue Sep 7, 2015 · 1 comment
Closed

wrap permanence #1663

reit-c opened this issue Sep 7, 2015 · 1 comment

Comments

@reit-c
Copy link

reit-c commented Sep 7, 2015

I've been thinking a bit about the add -w wrapper functionality, which helpfully permits users to add single files to IPFS and give them a proper filename (for browsers/applications to know what type of file it is and so on), which is great, but it unfortunately damages the long-term permanence factor of IPFS. The problem being, one of the stated goals of IPFS was content-addressed objects with links that don't break, but I fear a common use case may end up being something like https://github.com/ipfs/ipfs.js where the file is addressed as / and since the hash is dependent on the filename these links have the capacity to be broken permanently. Even if an identical file becomes available elsewhere under other circumstances it is unlikely the file names will match, nor could the swarms be joined.

However, since single files are not directories and do not have children, in the event that a hash is resolved to a single file and not a directory it should be possible to take the remainder of the path as the file name. That is, both Qm12345678990, Qm12345678990/something.png, and Qm12345678990/somethingelse.png could all refer to the same file, ensuring that even in the event the file names of wrapped objects change the network itself would still continue to recognize them as the same files.

@jbenet
Copy link
Member

jbenet commented Sep 7, 2015

Hey @reit-c, thanks for bringing up the concern, but i think there's a misunderstanding in your model.

Both the file and the wrapping directory have their own hash. the directory links to the file via it's hash. e.g.:

> echo foo >bar
> ipfs add -w bar
added QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 bar
added QmZb5Gox3Xpsv1hrdeMsnmL5wdMFLmG6Ph54kSmWhBihyn
> ipfs ls QmZb5Gox3Xpsv1hrdeMsnmL5wdMFLmG6Ph54kSmWhBihyn
QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 12 bar
> ipfs cat QmZb5Gox3Xpsv1hrdeMsnmL5wdMFLmG6Ph54kSmWhBihyn/bar
foo
> ipfs cat QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6
foo

a recursive pin pins both:

> ipfs pin add -r QmZb5Gox3Xpsv1hrdeMsnmL5wdMFLmG6Ph54kSmWhBihyn
# pins QmZb5Gox3Xpsv1hrdeMsnmL5wdMFLmG6Ph54kSmWhBihyn recursively
# pins QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6 indirectly

I think this addresses your concern. If this continues not to be clear, reopen.

since single files are not directories and do not have children,

incorrect. big files are chunked and do have children.

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

No branches or pull requests

2 participants