dbm.fsdbm- File-system dbm
Implements fsdbm. Extends
Fsdbm is a dbm implementation that directly uses
the filesystem. Basically, it uses file names for keys,
and file content for values. Unlike other dbm implementations,
this doesn’t depend on external libraries—it is pure Scheme
implementation—so it is always available, while other dbm
implementations may not.
Obviously, it is not suitable for the database that has
lots of entries, or has entries deleted and added very frequently.
The advantage is when the number of entries
are relatively small, and the values are relatively large while
keys are small.
The database name given to
is used as a directory name that stores the data.
The data files are stored in subdirectories under path of
fsdbm instance, hashed by the key. Non-alphanumeric characters
in the key is encoded like
_3a for ’
:’, for example.
If a key is too long to be a file name, it is chopped to chunks,
and each chunk but the last one is used as a directory name.
Note that a long key name may still cause a problem, for example,
some of old ’tar’ command can’t deal with pathnames (not each
pathname components, but the entire pathname) longer than 256
Fsdbm implements all of the dbm protocol (see Generic DBM interface). It doesn’t have any fsdbm-specific procedures.