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

Document the code flow of adding a file using ipfs add <file> command. #5858

Open
nitishm opened this issue Dec 19, 2018 · 11 comments
Open

Document the code flow of adding a file using ipfs add <file> command. #5858

nitishm opened this issue Dec 19, 2018 · 11 comments
Labels
topic/docs-ipfs Topic docs-ipfs

Comments

@nitishm
Copy link

nitishm commented Dec 19, 2018

PH to capture the life of the ipfs add <file> command from the CLI, to highlight :

@nitishm
Copy link
Author

nitishm commented Dec 19, 2018

#5052

@schomatis
Copy link
Contributor

@schomatis How can I tag my issue #5858 with the milestone ?

Oh, you can't, sorry, forgot about the permissions bla blah, I'll take care of that.

@schomatis schomatis added this to the Files API Documentation milestone Dec 19, 2018
@schomatis schomatis added the topic/docs-ipfs Topic docs-ipfs label Dec 19, 2018
@schomatis
Copy link
Contributor

As a first step I would skip all the options handling code in the CoreAPI and go directly to AddAllAndPin() (assuming the default or most common used options).

@nitishm
Copy link
Author

nitishm commented Dec 19, 2018

@schomatis Ok that makes it much easier to capture.

@schomatis
Copy link
Contributor

Also some of the documentation of #5081 and related (now a bit outdated) may contain useful information overlapping with this.

@nitishm
Copy link
Author

nitishm commented Dec 19, 2018

Also some of the documentation of #5081 and related (now a bit outdated) may contain useful information overlapping with this.

Will make sure I capture all the important contents from the issue.

@nitishm
Copy link
Author

nitishm commented Dec 19, 2018

@schomatis Quick question to resolve my confusion. How is it that if I add a file through the WebGUI I can list it using ipfs files ls but I do the same with ipfs add <file> --pin=true I cannot see it using ipfs files ls. Is there some concept that I might have overlooked ?

@schomatis
Copy link
Contributor

schomatis commented Dec 19, 2018

Excellent question!

I don't have time at the moment for the full answer but the summary would be: the are two layers of abstraction at play here, when I add a file with ipfs add I'm at the DAG/UnixFS layers, IPFS chunks it and organizes it in a DAG using the CID of the root to reference the file, its there, you can list it with ipfs ls (which looks for it in the DAG layer). On top of that you have MFS, which create a virtual filesystem where you can organize UnixFS files with more flexibility, you manipulate that with ipfs files (which I'm realizing now it's a rather unfortunate name, because we're not talking about any file but rather only the files in this special filesystem, it should be called the ipfs mfs command). So you add a file first to the "IPFS world" where you formatted in a DAG with UnixFS attributes to keep the file metadata, and then you can add that file to your local MFS with ipfs files cp which brings it into your filesystem.

Everything is a UnixFS file, but not every UnixFS file you add lives in your MFS.

(please ping me later about this subject for a more detailed answer and lets get this in https://github.com/ipfs/docs/issues/133, I can't begin to tell you how useful this question is, this is something I also wondered about when I started with this, and then I forgot about it)

@nitishm
Copy link
Author

nitishm commented Dec 20, 2018

@schomatis I have a short writeup in Markdown format ready for this task. Where do you want me to add it ? Should this go in the ipfs/docs, under contents ?

@schomatis
Copy link
Contributor

Open a PR in this repo (in the docs dir) or just paste it at the top of this issue.

@nitishm
Copy link
Author

nitishm commented Dec 20, 2018

#5864 Created a PR in the docs directory.

@daviddias daviddias added docs and removed docs labels Oct 1, 2019
@Stebalien Stebalien removed this from the Files API Documentation milestone Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/docs-ipfs Topic docs-ipfs
Projects
None yet
Development

No branches or pull requests

4 participants