-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
MFS Root vs MFS File/Directory #5066
Comments
/cc @Stebalien |
/cc @Stebalien :) |
Probably for historical reasons. This is now technically incorrect as we now support Raw IPLS objects as well.
We may have used that field at one point but yes, it appears unused. Feel free to remove it for now.
Yes? That is, they all need access to some DAG service.
I have no idea what that was for. If it's unused, remove it.
I believe the root is supposed to be able to be either a file or a directory but I'm not sure why. I also agree that it probably doesn't work as a file. If I had to guess, I'd say that we probably wanted MFS to be the way to create/modify files in IPFS. We may have planned on deprecating some of our other file builder utilities. However, that's purely speculation. @whyrusleeping?
So, in general, this is an abuse of contexts. We shouldn't be storing them like that... Putting that aside...
Yes, and 🤷♂️. |
I think we can probably move to assuming its always a directory. That might clean up a few things.
Yeah... This was written before I knew better. The only reason its still useful is that other than that, agree with @Stebalien |
With #5170 making explicit that the |
It is needed to better understand the relationship between a In the Assuming (for the sake of the example) that its parent is also a The ( Now this continues repeatedly through the (parent) directories of this tree until the Looking closer at the undocumented it now becomes more clear that it's a way for a child to transmit information to its parent about its own modification, since normally at the DAG and UnixFS layers a child has no link to its parent to send it any signal (this last part is the key aspect that should be documented to help understand the necessity for this connection at the MFS layer). |
Exactly. This is how we 'bubble up' changes. 'childCloser' definitely needs a better name... |
This will be continued in ipfs/go-mfs#3. |
I would like to understand (and possibly decouple) the relationship between those two.
I'm looking at the
NewRoot
function,https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/mfs/system.go#L69-L104
The
Root
is created from aProtoNode
(instead of anipld.Node
, why?) that is usually an empty directory and stores anode
reference to it, which doesn't seem to be used anywhere in the code.They all share the reference to (I'm assuming the same)
DAGService
, is that necessary?The
Type
field of theRoot
(which one could mistakenly associate with theType()
function of theFSNode
interface to whichRoot
doesn't belong) also doesn't seem to be used anywhere in the code. This also make it harder to conceptually distinguish between the Root and the File/Dir types (coupled with other minor details like theFlush()
function that is part of theFSNode
interface thatRoot
also implements, besides File and Dir, that one could associate with those types).The switch in
NewRoot
seems to allow the possibility that the root value (val
) can either be a directory or a file but other functions likeMkdir
assume the root is aDirectory
,https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/mfs/ops.go#L132
Another thing that may generate confusion is that the
Context
argument received byNewRoot
is namedparent
and then passed toNewFile
andNewDirectory
functions which use the nameparent
not for the context passed (which uses the more standardized namectx
) but rather for theipld.Node
(which seems to make more sense). Could theparent context.Context
be renamedctx context.Context
? What is the rationale behind that name?The text was updated successfully, but these errors were encountered: