Conversation
If this is done, it may be worth repeating the warning from the files api (the one in
I suppose these are kind of necessary to allow for migrations / prevent stagnation of MFS trees.
I'm a fan of this, in the same way
This is kind of a tangent, but I should mention that in the fuse pkg's For example, if the source reader is a DagReader|files.File, etc. and the writer is an MFS file, we could do the equivalent of
I wonder about consistency here. Some of the other objects have a |
mfs.go
Outdated
| Open(ctx context.Context, path MfsPath) (File, error) | ||
| OpenFile(ctx context.Context, path MfsPath, flag int, perm os.FileMode) (File, error) | ||
|
|
||
| Stat(ctx context.Context, path MfsPath) (os.FileInfo, error) |
There was a problem hiding this comment.
TODO: change this to match ipfs files stat better
There was a problem hiding this comment.
Maybe but I'd consider not materializing the CID here for performance reasons. IMO, files stat command should call Flush and Stat.
(although... there are some atomicity issues there...)
|
Tell me when you'd like me to review this. |
mfs.go
Outdated
| // | ||
| // This interface is inspired by https://godoc.org/github.com/src-d/go-billy, | ||
| // but doesn't implement it | ||
| type MfsPath interface { |
There was a problem hiding this comment.
We don't have to do this now, but I'd like to prefix all MFS paths with /local. If we do that, we won't have to have this special type (and we'll get rid of a bunch of namespace conflict issues.
(the upgrade path will be interesting but we may have to save this for an API refactor)
There was a problem hiding this comment.
- Should we support resolving
/localoutside Files API?- Yes but disable on gateway api?
- How should
ipfs filescommands handle those?- Just prefix everything with
/local?- Might be confusing for users (i.e. why those commands have to be different)
- Does
/ipfsequal/local/ipfseverywhere?
- Just prefix everything with
I slowly starting to think that using fancy types for paths isn't the best way to handle them (#16, #15), but using raw strings introduces another set of problems (CID serialization to name one). There is some trade-off to be made here..
There was a problem hiding this comment.
FWIW, in the mount implementation I have the Files API mounted under /files, I almost feel like /local is a bit of a misnomer given that files placed there are still published/accessible to the network.
There was a problem hiding this comment.
(for a bit of context, I think /local initially appeared in ipfs/kubo#4666 (comment))
There was a problem hiding this comment.
"files" is fine, really. or maybe just "file" to match the file:/// schema? My goal is just to disambiguate paths.
Should we support resolving /local outside Files API?
See ipfs/specs#98 and ipfs/specs#98 (comment). The hope was to eventually find a way to unify these APIs.
For now, let's just push forward with what we have. I think this is a bikeshed for another day.
mfs.go
Outdated
| Open(ctx context.Context, path MfsPath) (File, error) | ||
| OpenFile(ctx context.Context, path MfsPath, flag int, perm os.FileMode) (File, error) | ||
|
|
||
| Stat(ctx context.Context, path MfsPath) (os.FileInfo, error) |
There was a problem hiding this comment.
Maybe but I'd consider not materializing the CID here for performance reasons. IMO, files stat command should call Flush and Stat.
(although... there are some atomicity issues there...)
mfs.go
Outdated
| // already a directory, MkdirAll does nothing and returns nil. | ||
| MkdirAll(ctx context.Context, path MfsPath, perm os.FileMode) error | ||
|
|
||
| Flush(ctx context.Context, path MfsPath) error |
There was a problem hiding this comment.
We might want to make this return the CID.
|
Oh, I didn't notice thiss! I was building #54 but perhaps I can take over this. What do you think @magik6k @Stebalien? |
|
@hacdias please do! I had forgotten about this. Also, take a look at https://github.com/spf13/afero for inspiration (looks like it may have inspired this interface as well). The main difference is that we need to pass contexts. |
|
This repository is no longer maintained and has been copied over to boxo/mfs. In an effort to avoid noise and crippling in the Boxo repo from the weight of issues of the past, we are closing most issues and PRs in this repo. Please feel free to open a new PR in Boxo (and reference this issue) if resolving this issue is still critical for unblocking or improving your usecase. You can learn more in the FAQs for the Boxo repo copying/consolidation effort. |
Quick draft of the interface, few things missing / need discussion:
Syncmethod, open files with--flush=falseunless file is opened withO_SYNC?io.Copycan useWriteTo/ReadFrom, but dedicated call would be more clear about what happens)cc @Stebalien @djdv