“... One of the cornerstones of the Inferno architecture is the Unix idea with file devices brought to the limit: everything is presented in Inferno files ...” powerman . And how, in the light of the above, can the database look like?
Getting acquainted with the possibility of a multilingual user interface in the wm / calendar program, I accidentally ran into a possible implementation ...
In Inferno OS there is an interesting way to present databases - in the form of a file system. To do this, use the command dbfs, rawdbfs - which mount the database as a file system.
Take, for example, the base of the calendar (wm / calendar):
')
rawdbfs -e user / inferno / cal / mnt / schedule
will mount the database from the user / inferno / cal file into the / mnt / schedule folder (if the cal file did not exist, it will be created, thanks to the -e switch). A list of files will be generated at the mount point, where each file corresponds to one record in the database. Due to this, it is possible to work with database records by creating and deleting, writing and reading the corresponding files. Writing to the NEW file new entries are created:
% echo 20071107 1> / mnt / schedule / new
in the empty meringue created the first entry to check:
% ls / mnt / schedule
/ mnt / schedule / 0
/ mnt / schedule / new
Our entry number is zero:
% cat / mnt / schedule / 0
20071107 1
The main difference between dbfs and rawdbfs in the way data is stored. In the first case, an ordinary text file is used, where the records are separated by an empty line; in the second, a special format that allows you not to overwrite the entire database file when you change the record alone, which is good for Flash drives.
There are other databases in Inferno: there are dbm, attrdb modules that work with their “formats”; as well as the dbsrv module, which allows access to the database of the main operating system (in case Inferno is used as a guest OS).