OpenDAL was on HN recently and would be a pretty decent abstraction to use for this: https://github.com/apache/incubator-opendal
OpenDAL was on HN recently and would be a pretty decent abstraction to use for this: https://github.com/apache/incubator-opendal
I made exactly this: https://github.com/mickael-kerjean/filestash The public API enables programmatical access to S3, SFTP, FTP, GIT, WebDav, Samba, Local FS, NFS, Backblaze, Storj, Artifactory, .... and more. Under the hood, each storage implements this interface:
type IBackend interface {
Ls(path string) ([]os.FileInfo, error)
Cat(path string) (io.ReadCloser, error)
Mkdir(path string) error
Rm(path string) error
Mv(from string, to string) error
Save(path string, file io.Reader) error
Touch(path string) error
}
There's some hook so you can define your own and do even more funky stuff like virtual FS wich compose onto anything you want/need. There's a bunch of weird implementation like the mysql storage, which represent first level folders as databases, second level folders as tables and files as the actual rows.fun fact: it was born out of a reflection from the infamous top comment of the Dropbox launch on HN
The remoteStorage protocol is one: https://remotestorage.io/. Sadly, it seems remoteStorage never took off. The first version of the spec was published in 2011, and the reference implementation reached version 1.0 in 2017, but if you look at the list of known apps that support it (https://remotestorage.io/apps/), there are few active projects.
Of course, having users manage a storage bucket and its key is a bit tedious. Browsers could generate a per-app bucket and provide the bucket key to the app, all with user permission (like when a site asks for location permissions).
These buckets can be shared between apps too. As long as apps can read the same data formats, data portability is stellar.
It would be great to have an ecosystem of apps that all use compatible buckets/formats.
But this is unlikely to happen bc this sort of transparency and data portability isn't currently a big demand by users / governments. Privacy activists have gotten a great number of wins over the past decade. We need to make progress in many more computing issues.
I also really like the https://sandstorm.io approach which goes a little farther beyond