-
-
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
[BOUNTY] Implement UnixFSv1.5 in go-ipfs #6920
Comments
For context, here is the js-ipfs unixfsv1.5 implementation done by @achingbrain: ipfs/js-ipfs#2621, and the blog post describing the shipped work: https://blog.ipfs.io/2020-02-13-js-ipfs-0-41/#unixfs-v1-5 If you want to start working on this, ping @Stebalien for a quick walkthrough of where to start and what already exists to build on top! |
Implementation NotesImplementing this feature will touch several sub-components of go-ipfs:
The new go-ipfs-files // Node is a common interface for files, directories and other special files
type Node interface {
io.Closer
// Mode returns the file's Mode
Mode() os.FileMode
// ModTime returns the files last modification time.
//
// If the last modification time is unknown/unspecified, ok is false and
// the mtime is the Unix epoch (default timestamp).
ModTime() (mtime time.Time, ok bool)
// Size returns size of this file (if this file is a directory, total size of
// all files stored in the tree should be returned). Some implementations may
// choose not to implement this
Size() (int64, error)
} |
@Stebalien Hi, @momack2 said to ping you for a walkthrough if one would like to start working on this, but I think it is safe to assume that your last comment is that walkthrough, and I will just go ahead. Thanks! |
And there are two new mfs commands:
|
Hey @kalmi! How are things going? Did you get your questions answered / are you unblocked? |
Hi! Thanks. I'm not blocked, I had some personal issues last week, sorry for the silence. I plan to spend most of the upcoming long weekend on this. So far I have got Status (WIP, "done" is very loosely defined at this point, this list is bound to be incomplete):
|
I'd drop the last two for now. Everything else looks good to me. Note: If you're trying to find where different types/functions are being used, I recommend grep.app. E.g., .NewMultiFileReader. |
Hey @kalmi! Any status update? Are you blocked? |
@momack2 I am making progress, albeit unfortunately it is slower than I originally expected due to external factors. Now I am at the point where I believe the I am making sure that all changes to the libraries are backward compatible. The Node interface change specified by Stebalien is not, but I guess that's reasonable and acceptable. When I have everything working, I will start making PRs in the proper merge order. Do you have a reasonable timeframe in mind for this that I should be aware of? |
Hey @kalmi! It'd be great to include this feature in the next release, go-ipfs 0.6. I think the feature cut for that release is ~2 weeks from Wednesday. Do you think that's a reasonable goal? Note, the sooner to put up draft PRs for review (and the more modular/well tested they are) the easier it will be to land this quickly. =] |
Could you open an issue on ipfs/js-ipfs please and we'll see if we can get to the bottom of the problem you had? |
@kalmi Any status updates? |
@achingbrain looks like there are still some issues running the tests, specifically when running the browser tests
Could you please investigate, the package browser-hrtime might provide a solution. |
Any idea what the current status of this is? I'd really like the feature and it seems soooooooo close. I'm not interested in the bounty but would really like to see it get over the finish line and if there's any way I could give it that final push I'd be happy to help out. |
@zacharywhitley so far this year it has been challenging finding the time to focus on this, I'll be looking to move the PRs out of draft within the next 6/8 weeks, if not sooner. |
@kstuart I'm really curious about your progress here! I would very much like to use this additional stat information in places where i'm (going to) list content from folders stored on IPFS. Just for my information. This additional stat info you're providing is also there when using the HTTP API, right? Not just internal to the unixfs layer? I'm asking because i intent to add IPFS browse support in KODI as a VFS plugin where it in the backend would use the HTTP API (it's near certain that i will be doing this). Likewise i want to add a KIO SLAVE (it's for KDE's file browsing capabilities) to support IPFS natively in KDE applications too, it too would fetch file data via the HTTP API. It's unlikely i'll be doing the KDE side of things anytime soon though, that really is just a wishlist item for me personally that keeps getting pushed back. |
@markg85 yes, if stored with mode and/or time that information is returned from the HTTP API. As per screenshot it returns the same fields as js-ipfs, except for I need to review |
Really looking forward to this. Quick question that I could probably answer by looking at the branch but you can make things easy on my if you don't mind my masking. Is this going to include an update to fuse to pass the info on to mounts? That's what I really want it for. I'm looking to replace SDKMan with IPFS so installing a new JDK is as simple as pinning the directory for that version and updating a couple of env vars. |
Nice! |
@zacharywhitley it's not in scope for this ticket, don't know what the plan is there. @markg85 all I can say is I'm currently working on it, barring any major issues it shouldn't be much longer. |
Thanks. That's fine. I was planning on writing a separate fuse implementation that also supported MFS so as long as it's there. |
@zacharywhitley More recently, I've been asked to make a standalone version of this, and have been porting those features over to it. If you need help with yours, feel free to ping me. |
Oh wow. That's fantastic and thank you for the offer of help. I will definitely keep in touch. You're from Philly? I went to Drexel University and used to work up in King of Prussia. I've always thought that IPFS mount was an unfortunate rough spot for IPFS that didn't get the love it deserved. It's called IPFS and you go to use it as a filesystem and it's a little disappointing. I guess this is more an MFS thing but I always thought it would be nice if it also supported snapshots. I'm thinking of it creating a hidden directory every time the root changes to move the old root to something like .snapshot-20210826-3489. It's immutable. I should be able to go to an old version. |
I am, I'm at the borders of Tacony and Holmesburg. :^)
Strongly agree. It was the only reason I downloaded it in the first place, only to be greeted with a "not supported yet" message.
Yeah this would be really cool. It's something I like a lot in systems like ZFS, and shouldn't be too difficult to come up with a scheme for in IPFS.
For what it's worth I at least ported over the read-only portions of this for now. They're here. |
How's it going with this? Seems like little progress lately? |
Last update was late June which refactored/improved/fixed the initial implementation, added support for recursively adding directory trees with mode/modification time and restoring them to the file-system and archive files. Left to do is supporting mfs chmod and touch commands on directories, I was not initially able to identify an implementation path in the time available for this so need to study the code-base some more, progress on this is dependent on my schedule which is quite tight. I've avoided moving dependent PRs out of draft status until all are ready, however if the dependent PRs are merged in order they shouldn't break anything, so I'll probably look to enable that shortly to avoid potential future conflict. if you're not aware progress and dependency tracking is in main PR #7754. |
This should now be feature complete and all related PRs have been promoted from Draft status. |
oh hell ya!!! Thank you. I've really been looking forward to this. Being able to run executables out of a fuse mounted ipfs is going to be great. |
Cool, sounds good. Well I was hoping for arbitrary metadata too (extended attributes) but that's not in 1.5 apparently. |
Replaces PR #34 written by @kstuart Adds support for storing and retrieving file mode and last modification time. Support added to: - [X] Files - [X] LinkFiles - [X] Webfiles - [X] Directories - [X] Tar Archives When the TAR archive (headers) include a file mode or modification time, the extractor will restore that metadata when supported for the underlying filesystem. The Golang runtime currently does not support changing the times on a symlink, for Linux and some BSDs a custom solution has been implemented, for Darwin this is not the case so when copying a symlink to the filesystem the last modification time is not updated. Since for concrete files and directories stored modes and modification times are faithfully restored to the filesystem this should not be a breaking issue, a similar solution to that implemented for Linux/BSDs is likely implementable by a developer with access to a Darwin platform. Replaces PRs: - ipfs/go-ipfs-files#31 - ipfs/tar-utils#11 - #34 Relates to ipfs/kubo#6920
Replaces #7754 written by @kstuart - ipfs/boxo#653 - ipfs/boxo#658 - [X] Can `ipfs add` with preserved mode and/or last modification time - [X] on files - [X] on directories - [X] Can `ipfs add` with custom mode and/or last modification time - [X] on files - [X] on directories - [X] Can `ipfs get` restoring mode and/or last modification time - [X] on files - [X] on directories - [X] in archives - [X] Can `ipfs files chmod` to change mode - [X] on files - [X] on directories - [X] Can `ipfs files touch` to change last modification time - [X] on files - [X] on directories - [X] Automatically update the last modification time when file data is changed or truncated (e.g. `ipfs files write`) - [X] Can add files and directories with mode and/or modification time using multipart-form data - [X] `ipfs files stat` reports mode and last modification time **Note:** - [X] Adds support to `kubo/core/rpc` (may require additional tests). - ~ipfs/interface-go-ipfs-core/pull/66~ replace by this PR - ~ipfs/go-unixfs/pull/85~ replaced by: ipfs/boxo#658 - ~ipfs/go-mfs/pull/93~ replaced by: ipfs/boxo#658 - ~ipfs/go-ipfs-files/pull/31~ replaced by: ipfs/boxo#653 - ~ipfs/tar-utils/pull/11~ replaced by: ipfs/boxo#653 - When adding files and directories without opting to store a mode or modification time the same CIDs are generated that would have been created before this feature was implemented (opt-in). - The Go runtime currently has no native support for restoring file mode and modification time on symbolic-links, support for restoring the last modification time has been added for Linux distributions and the following BSDs: freebsd, netbsd, openbsd, dragonflybsd. - Automatically updating a modification time will only occur if a modification time was previously stored. - When creating an archive, for compatibility, time resolution is to the second; Nanoseconds are not supported. The `ipfs add` options `--preserve-mode` and `--preserve-mtime` are used to store the original mode and last modified time of the file being added, the options `--mode`, `--mtime` and `--mtime-nsecs` are used to store custom values, a custom value of 0 is a no-op as is providing `--mtime-nsecs` without `--mtime`. The preserve flags and custom options are mutually exclusive, if both are provided the custom options take precedence. --- Closes #6920
This commit introduces initial Mode and ModTime support for single filesystem files and webfiles. The ipfs add options --preserve-mode and --preserve-mtime are used to store the original mode and last modified time of the file being added, the options --mode, --mtime and --mtime-nsecs are used to store custom values. A custom value of 0 is a no-op. The preserve flags and custom options are mutually exclusive, if both are provided the custom options take precedence. Majority of of the code was from #7754 written by kstuart Replaces #7753 Closes #6920
This issue has a bounty!
Successfully closing this issue by producing a production-ready, mergeable PR can earn you not only the undying love of the IPFS community — it can net you a financial reward. See the current list of bounty issues and their values here.
The need in brief
Add UnisFSv1.5 metadata support per the spec https://github.com/ipfs/specs/blob/master/UNIXFS.md#data-format, which includes: specifying metadata, respecting existing metadata, and displaying metadata.
This aims to support large data import use cases (ex package managers), who need to retain file metadata, particularly last modified time (
mtime
), in order to selectively sync only data that has changed. Up until now if you wanted to host a large data set on IPFS, like a package manager's repository, it would be difficult to update - but with filemtime
you can only reimport the changed files, making things much more efficient.Deliverable
ipfs add
on one IPFS node toipfs get
on another.Requirements
ipfs add
must not change except when the user has requested that metadata be preserved via the appropriate flags (see the implementation details below). Specifically, the final hash produced byipfs add
must not change.Guidelines
The text was updated successfully, but these errors were encountered: