cdbmake - create a constant database
cdbmake cdb cdb.tmp
reads a series of encoded records from its standard input and
writes a constant database to cdb
ensures that cdb
is updated atomically, so programs
never have to wait for cdbmake
to finish. It does
this by first writing the database to cdb.tmp
and then moving
on top of cdb
. If cdb.tmp
already exists, it is
destroyed. The directories containing cdb.tmp
writable to cdbmake
; they must also be on the same filesystem.
always makes sure that cdb.tmp
is safely written to disk
before it replaces cdb
. If the input is in a bad format or if
has any trouble writing cdb.tmp
to disk, cdbmake
complains and leaves cdb
Records are indexed by keys. A key is a string. cdb
is structured so that
another program, starting from a key, can quickly find the relevant record.
allows several records with the same key, although most readers
take only the first record, and cdbmake
slows down somewhat if there
are many records with the same key.
(1) preserve the order of records.
A record is encoded for cdbmake
followed by a newline.
is the number of bytes in key
number of bytes in data
. The end of data
is indicated by an
extra newline. For example:
may contain any characters, including colons, dashes,
newlines, and nulls.
Keys and data do not have to fit into memory. A database cannot exceed 4
is portable across machines.
cdbdump(1), cdbget(1), cdbstats(1)