Charles.Forsyth20060303-partialeea662d19 years agoHistory
127 lines · 2.8 KB · Text
RawDownload
.TH DBFS 4.SH NAMEdbfs, rawdbfs \- simple database file system.SH SYNOPSIS.B dbfs[.B -abcer].I file mountpoint.br.B rawdbfs[.B -abcelrx][.B -u.I cmd].I file mountpoint.PP.IB mountpoint /new.br.IB mountpoint /0.br.IB mountpoint /1.br.IB mountpoint /\fR...\fP.SH DESCRIPTION.B Dbfsand.B rawdbfsboth expose a simple, record-based filesystem storedin.IR file .The.BR -a ,.BR -b ,.BR -c ,and.B -roptions have the same meaning as the options accepted by.IR bind (1).If the.B -eoption is given, then.I filewill be created if it does not already exist.The filesystem provided by both.B dbfsand.B rawdbfsis substantially the same:when started,.I mountpointis populated with numbered files, one for each record found in.IR file .A read of one of these files yields the data in the record;a write stores data in the record. A new record can be createdby opening the.B newfile; writes to this file write to the new record. The nameof the new file can be discovered by using.I fstatin.IR sys-stat (2).Records can be removed by removing the appropriaterecord file..PP.B Rawdbfshas additional features for database use: .BR -xcauses two additional files ("index" and "stats") to  appearin the mounted directory,.BR -lspecifies that a record can only be opened for writingby one process at once, and .BR -u.I cmdspecifies a .IR sh (1)command to be run whenever the contents of the database change.The index file is provided as a convenience for databaseclient applications. Once initialised (by writing an integer value to it),subsequent reads return an ever-increasing integer value.Reading the stats file returns counts of databaseread, write, create and delete operations as a string of fourintegers..PP.B Dbfsand.B rawdbfsdiffer in the way that they store their data..B Dbfsstores its records in.I filein a simple text format: the end of a record is indicatedby an empty line. The file is completely rewritten every timea record is written. Storing records containing blank lineswill lead to confusion when the database is re-read..B Rawdbfscan store arbitrary data, but the format of the datastorage is known only to itself. It does not rewritethe whole file on every record change, so can be moresuitable for flash-based storage, where it is importantto minimise the number of writes..PPNote that the record numbers always get their initialnumbering from the order of the records in.IR file .You cannot assume that the filename given to a recordwill remain the same between runs of.BR dbfs ..SH SOURCE.B /appl/cmd/dbfs.b.br.B /appl/cmd/rawdbfs.b.SH SEE ALSO.IR memfs (4),.IR ramfile (4),.IR wm-calendar (1).SH BUGSWrite offsets are ignored, so the maximum amount of datathat can be stored in a record is ATOMICIO bytes (i.e. 8K)..PPThere is no way to compact a file maintained by.BR dbfs .