Open Stebalien opened 4 years ago
I like this idea! It makes it possible to have a folder "synced" on IPFS.
But.. I don't really understand the part where it makes it available on IPFS. You say "use MFS (go-mfs) to add the file to an IPFS directory". How does that magically work? Where's the glue that makes it available on IPFS?
Also, why is there a need for a database in this logic? IPFS internally stores data, can't that be (ab)used to store this too?
Edit.
What you propose is - on linux at least - conceptually not that difficult. I do this very same logic with inotify where i'm watching one folder for changes and index those files in a SQLite database. It allows me to say things like "hey google, ask
But.. I don't really understand the part where it makes it available on IPFS. You say "use MFS (go-mfs) to add the file to an IPFS directory". How does that magically work? Where's the glue that makes it available on IPFS?
I believe the idea is something similar to what ipfs-sync does, just without using the HTTP API. If you add a directory like /home/user/Documents/MyIPFSWebsite
it's mirrored into MFS as /ipfs-sync/MyIPFSWebsite
. On MFS, it's not magic, MFS works sorta like a pin, so the node makes the data available like it would any other data.
Proposal: a tool for watching a folder and making it available over over IPFS (a) without having to re-add everything any time a file changes and (b) without having to duplicate the file data on disk.
Users currently use the "filestore" feature to add files to go-ipfs without storing the data on disk twice. Unfortunately, the filestore doesn't integrate very well with go-ipfs as-is because go-ipfs expects pinned data to remain available, while files on disk can change. Furthermore, re-syncing a large directory into go-ipfs can be quite expensive.
IMO, the best solution would be to not use the go-ipfs daemon, but instead is to implement an
ipfs-watch
tool. It would:The database schema would be:
Events:
DELETE FROM blocks where filename=filename
(just in case)DELETE FROM blocks where filename=filename
Prior art and related: