-
-
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
How are files formatted inside nodes? #5059
Comments
I'm now realizing that there are two and the other one is an interface in the Is this intentional? How much related are they? |
/cc @Stebalien |
I'm following the trickle importer to understand how are the DAG and UnixFS layers connected, most of the logic resides in the which combines the different layers and exposes them through generic-named functions that make it hard to understand when is the work being done on the DAG node and when on the UnixFS object. As an example I'll try to detail the basic trickle importer process and what problems might a new user face when trying to dig through the code. The entry-point
In the simplest case of a one-level layered DAG the The ambiguity of the Going back to which creates a First, the coupling of the two layers makes it hard to understand that the difference resides in the UnixFS layer where now the type is a raw object. Second, it is by no means apparent why has the type change from After the (file) data is obtained and stored in the UnixFS object its encapsulating node is added to its parent in Again the Returning to Only now it is made more clear the relationship between the entities of This function |
I believe that is the case and I have no idea why either. IIRC, it's basically just an historical quirk. Note: there are also DagRaw nodes. These are raw (binary) IPLD nodes that we use in the leaves of a file if the |
Thanks @Stebalien, do you have any idea on the |
/cc @Stebalien ^^ |
This one fell through the cracks and I assume you may already know the answer to this but... they're just two different FSNodes. They both represent a single object in the filesystem (file, symlink, directory, etc.) but one is an interface used by MFS and the other is a concrete type used to store the actual data. |
Yes, thanks. I would love to change the name of either of two, or add 35 lines of comment all of them saying: "watch it! this is not what you think it is.." |
I think this has been clarified enough with the balanced builder refactoring (which should be used as the reference to understand the question of this issue, the trickle builder will follow a similar process in ipfs/go-unixfs#10). |
Roughly speaking a block is formatted as a node (with links/children) using the
merkledag.pb
package. On top of the DAG layer the UnixFS format is used to represent files and directories (but those two layers are not as decoupled as the previous two). Theunixfs
package has (basically) 3 types of objects,Raw
,File
andDirectory
. The importers split files and arranges the chunks in DAG nodes that contain UnixFS objects of typeRaw
andFile
(using the DAG links to connect them).I'll be studying the
importer
package (and related) and registering what I find here to later convert that information in the form of comments and small code refactoring (any feedback or code pointers is more than welcomed).What I'm having the most trouble understanding is when is the the
File
type used in the UnixFS objects and whenRaw
(it would seem thatRaw
is used in the leaves of the DAG andFile
for the rest, but if that is the case I'm not understanding why). Also the interaction between theProtoNode
layer and theFSNode
layer (which I would like to rename to FSObject and leave Node for the DAG layer) which are encapsulated in aUnixfsNode
structure which seems to have many representations. Also how does the MFS root fit into all of this.The text was updated successfully, but these errors were encountered: