djdv / go-filesystem-utils

ISC License
10 stars 2 forks source link

mount: support IPFS' MFS #14

Open djdv opened 1 year ago

djdv commented 1 year ago

We have an old implementation of this here that was written before Go's fs.FS interface. This needs to be updated for UFS 1.5 and since we're no longer directly within go-ipfs, we'll need to update it to use the client APIs.

Last time I checked, the API does not allow overwriting the root node like we could do before. I think we'll also have to do synchronization manually (instead of being able to pass in a callback that's triggered on modifications).

With these limitations, I'm thinking about just creating a mount subdirectory within the MFS root, and treating that as our mutable root instead of the actual root (since we can't tell the IPFS node to replace it as-is). Maybe allowing this to be changed with parameters so that users can mount arbitrary directories within the MFS root.

djdv commented 1 year ago

Preliminary support for this was added in caa06f58819863270f4994701a81eabce2680090 of a development branch (j/ipfs-fs-extensions). These will be broken out into a PR sometime later.

In that branch, our mounting utility will look in an IPFS node's Files API root, for a directory named /mount (creating it on the node if it doesn't exist), and mount it on the host.