File System as Database
COTTRELL, JAMES
cottrell at NBS-VMS.ARPA
Sat Mar 1 07:01:32 AEST 1986
/*
> >From: cottrell at NBS-VMS.ARPA (COTTRELL, JAMES)
> >Allow me to propose a kluge. Since on can create lockfiles of any
> >name, create a parrallel directory /whatever/lock, and create lock
> >files of the form `name#number' in that directory. Thus to lock
> >record three of file `foo' create a lock /whatever/lock/foo#3'.
> >Multi-record lox are more difficult, but can be done with a little
> >head scratching. Yeah, it ain't pretty, but it just might work.
>
> I have a better idea. Being as 4.2bsd can have up to 256 characters
> in a file name and that most data-bases can live with less than 256
> characters in a record (or a multiple, fixed record scheme can be
> used, or even variable) why not just store the data in the file names
> and leave the files empty (or fill them with change info or something.)
We would have to encode the data. No slashes or nulls allowed, and
some systems barf if the high order bit is set.
> You can then use all those file searching things (like wildcards and
> 'find') as data-base queries, you can do 'record' locking etc etc.
> Touch becomes the data-entry program, rm for removing, built in dates
> of creation, modification, access, ownership kept in the inode, guaranteed
> synchronous write-through on update, atomicity of record creation...
And `mv' becomes the record lock!
What do you mean UNIX has no database system? The File System *IS* a
database !?! Keep one record in a given file. Any link to it is an index
to a particular field. Example:
set id = `getnewid`
cat >/db/id/$id << EOF
$id, cottrell, james, e, iii, m, 31, 999
EOF
ln /db/id/$id /db/last/cottrell.$id
ln /db/id/$id /db/middle/e.$id
ln /db/id/$id /db/suffix/iii.$id
ln /db/id/$id /db/sex/m.$id
ln /db/id/$id /db/age/31.$id
ln /db/id/$id /db/iq/999.$id
Now if only those directorys were sorted :-)
> I know, shut up Barry, you've lost your mind again....
Me too!
> -Barry Shein, Boston University
jim cottrell at nbs
*/
------
More information about the Comp.lang.c
mailing list