Open djdv opened 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.
/a
and /a/b
at the same time. This seems likely to deadlock somewhere in the MFS API, and/or desync.cp $new-root-cid /stage; mv /current-root /temp; mv /stage /current-root; rm /temp
.)
These should be quick reference updates, but there could also just be an API endpoint that allows us to replace-root $newCID
; where the IPFS node atomically handles this internally and safely.
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 withingo-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.