|Perl: the Markov chain saw|
RFC: Fuse::DBI - mount database as filesystemby dpavlin (Friar)
|on Oct 09, 2004 at 00:59 UTC||Need Help??|
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 :-).
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.
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?