From time to time I wanted to access data in my database as a filesystem. Wouldn't it be nice to just say
To edit one field instead of writing SQL? But, after installation of WebGUI I realised that I have to do something. All templates are stored in database, and edit box is so small (and without support for vi key bindings :-).vi /db/invoice/2004/01/03/paid.txt
At about same time, I stumbeled upon Fuse project with it's perl bindings. I had idea, and it was simple: write a bridge between database and filesystem.
That bridge is called Fuse::DBI. I just announced it on WebGUI site, but now I have doubt: is this module right material for CPAN?
I should stress that this module isn't general purpose database to filesystem bridge. It allows user to export one part of database (usually one or more tables) as a filesystem (much like /proc filesystem on Linux).
This is done with three SQL queries: one to return filenames, lenghts and write permission, another to return content and third one to update content. It also has optional code hook to invalidate cache (on disk cache created from database for example) if needed.
Advantage of this approach is ability to use different filesystem tools to access data from database without writing specific support for each of them (like editors, ftp servers and so on).
On one hand, we have binding of Lufs (other project with similar goal) on CPAN allready. On other hand, Lufs module is binding for lufs, not module which uses another perl module which isn't on CPAN.
What is best practice for situations like this? Do you like idea to mount database as filesystems?
Please be gantle. I don't think that code is best example how to write perl module, partly because of functional interface in Fuse module itself. But, result is so interesting that I wanted to share it.
In reply to RFC: Fuse::DBI - mount database as filesystem by dpavlin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |