Skip to content

feat(fuse): Expose MFS as FUSE mount point #10781

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/ipfs/kubo/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
initProfileOptionKwd = "init-profile"
ipfsMountKwd = "mount-ipfs"
ipnsMountKwd = "mount-ipns"
mfsMountKwd = "mount-mfs"
migrateKwd = "migrate"
mountKwd = "mount"
offlineKwd = "offline" // global option
Expand Down Expand Up @@ -173,6 +174,7 @@
cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem using FUSE (experimental)"),
cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
cmds.StringOption(mfsMountKwd, "Path to the mountpoint for MFS (if using --mount). Defaults to config setting."),
cmds.BoolOption(unrestrictedAPIAccessKwd, "Allow RPC API access to unlisted hashes"),
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
Expand Down Expand Up @@ -1058,17 +1060,23 @@
nsdir = cfg.Mounts.IPNS
}

mfdir, found := req.Options[mfsMountKwd].(string)
if !found {
mfdir = cfg.Mounts.MFS
}

Check warning on line 1066 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1063-L1066

Added lines #L1063 - L1066 were not covered by tests

node, err := cctx.ConstructNode()
if err != nil {
return fmt.Errorf("mountFuse: ConstructNode() failed: %s", err)
}

err = nodeMount.Mount(node, fsdir, nsdir)
err = nodeMount.Mount(node, fsdir, nsdir, mfdir)

Check warning on line 1073 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1073

Added line #L1073 was not covered by tests
if err != nil {
return err
}
fmt.Printf("IPFS mounted at: %s\n", fsdir)
fmt.Printf("IPNS mounted at: %s\n", nsdir)
fmt.Printf("MFS mounted at: %s\n", mfdir)

Check warning on line 1079 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1079

Added line #L1079 was not covered by tests
return nil
}

Expand Down
1 change: 1 addition & 0 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
Mounts: Mounts{
IPFS: "/ipfs",
IPNS: "/ipns",
MFS: "/mfs",

Check warning on line 61 in config/init.go

View check run for this annotation

Codecov / codecov/patch

config/init.go#L61

Added line #L61 was not covered by tests
},

Ipns: Ipns{
Expand Down
1 change: 1 addition & 0 deletions config/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ package config
type Mounts struct {
IPFS string
IPNS string
MFS string
FuseAllowOther bool
}
10 changes: 9 additions & 1 deletion core/commands/mount_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
const (
mountIPFSPathOptionName = "ipfs-path"
mountIPNSPathOptionName = "ipns-path"
mountMFSPathOptionName = "mfs-path"
)

var MountCmd = &cmds.Command{
Expand Down Expand Up @@ -81,6 +82,7 @@ baz
Options: []cmds.Option{
cmds.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."),
cmds.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."),
cmds.StringOption(mountMFSPathOptionName, "m", "The path where MFS should be mounted."),
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
cfg, err := env.(*oldcmds.Context).GetConfig()
Expand Down Expand Up @@ -109,7 +111,12 @@ baz
nsdir = cfg.Mounts.IPNS // NB: be sure to not redeclare!
}

err = nodeMount.Mount(nd, fsdir, nsdir)
mfdir, found := req.Options[mountMFSPathOptionName].(string)
if !found {
nsdir = cfg.Mounts.MFS
}

err = nodeMount.Mount(nd, fsdir, nsdir, mfdir)
if err != nil {
return err
}
Expand All @@ -124,6 +131,7 @@ baz
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, mounts *config.Mounts) error {
fmt.Fprintf(w, "IPFS mounted at: %s\n", cmdenv.EscNonPrint(mounts.IPFS))
fmt.Fprintf(w, "IPNS mounted at: %s\n", cmdenv.EscNonPrint(mounts.IPNS))
fmt.Fprintf(w, "MFS mounted at: %s\n", cmdenv.EscNonPrint(mounts.MFS))

return nil
}),
Expand Down
1 change: 1 addition & 0 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type IpfsNode struct {
type Mounts struct {
Ipfs mount.Mount
Ipns mount.Mount
Mfs mount.Mount
}

// Close calls Close() on the App object
Expand Down
5 changes: 5 additions & 0 deletions docs/changelogs/v0.35.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This release was brought to you by the [Shipyard](http://ipshipyard.com/) team.
- [Dedicated `Reprovider.Strategy` for MFS](#dedicated-reproviderstrategy-for-mfs)
- [Additional new configuration options](#additional-new-configuration-options)
- [Grid view in WebUI](#grid-view-in-webui)
- [Expose MFS as FUSE mount point](#expose-mfs-as-fuse-mount-point)
- [📦️ Important dependency updates](#-important-dependency-updates)
- [📝 Changelog](#-changelog)
- [👨‍👩‍👧‍👦 Contributors](#-contributors)
Expand Down Expand Up @@ -42,6 +43,10 @@ The WebUI, accessible at http://127.0.0.1:5001/webui/, now includes support for

> ![image](https://github.com/user-attachments/assets/80dcf0d0-8103-426f-ae91-416fb25d32b6)

#### Expose MFS as a FUSE mount point

The MFS root is now available as a read/write FUSE mount point at `/mfs`. This filesystem is mounted in the same way as `/ipfs` and `/ipns` when running `ipfs mount` or `ipfs daemon --mount`.

#### 📦️ Important dependency updates

- update `ipfs-webui` to [v4.7.0](https://github.com/ipfs/ipfs-webui/releases/tag/v4.7.0)
Expand Down
Loading
Loading