[erlang-questions] Re: This file system path thing is getting me down...

Ulf Wiger ulf.wiger@REDACTED
Tue Aug 25 18:27:03 CEST 2009


Steve Davis wrote:
> 
> My current thinking is perhaps to abstract the entire file system as a
> data source and query it like a database (maybe using qlc) and only
> ever return absolute names.
> 
> /sd

FWIW, when I experimented with user-defined tables in the
'rdbms' contrib, one of the table types I played with was
a file system.

http://jungerl.cvs.sourceforge.net/viewvc/jungerl/jungerl/lib/rdbms/src/rdbms_rofs.erl?revision=1.1&view=markup

The technique for adding user-defined tables was more or less
copied in the Dukes of Erl project mnesiaex

http://code.google.com/p/mnesiaex/

That is not to say that the two are compatible (I haven't looked into it).

I never got around to documenting it, or even writing any
test code for it, but basically, you would create a table
(ordered_set) using

[{external_copies, [{rdbms_rofs, Nodes}]},
  {rofs_mount, MountPoint}|Attrs]

Basically, the record could contain the following attributes:

ValidAttrs = [path,name,data|record_info(fields, file_info)],

where path was mandatory and held the full path name.
The 'data' attribute would hold the contents of the file,
if included among the record attributes.

The idea was indeed to be able to query the file system using
e.g. QLC, and do other fun databasey stuff. I only dared make
it read-only, though. :)

 From my limited testing, it seemed to work, but the code hasn't
been maintained, and rdbms is likely to break with anything other
than mnesia-4.5.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list