cdbmake

Langue: en

Autres versions - même langue

Version: 57221 (mandriva - 22/10/07)

Section: 1 (Commandes utilisateur)

NAME

cdbmake - create a constant database

SYNOPSIS

cdbmake file temp

DESCRIPTION

cdbmake reads a series of encoded records from its standard input and writes a constant database to file.

Records are indexed by keys. A key is a string. file is structured so that another program, starting from a key, can quickly find the relevant record. cdbmake allows several records with the same key, although (1) most readers only take the first record and (2) cdbmake slows down somewhat if there are many records with the same key. Note that cdbmake preserves the order of records in file.

A record is encoded for cdbmake as +klen,dlen:key->data followed by a newline. Here klen is the number of bytes in key and dlen is the number of bytes in data. The end of data is indicated by an extra newline. For example:


   +3,5:one->Hello

   +3,7:two->Goodbye

   

key and data may contain any characters, including colons, dashes, newlines, and nulls.

cdbmake ensures that file is updated atomically, so programs reading file never have to wait for cdbmake to finish. It does this by first writing the database to temp and then moving temp on top of file. If temp already exists, it is destroyed. The directories containing temp and file must be writable to cdbmake; they must also be on the same filesystem.

cdbmake always makes sure that temp is safely written to disk before it replaces file. If the input is in a bad format or if cdbmake has any trouble writing temp to disk, cdbmake complains and leaves file alone.

Keys and data do not have to fit into memory, but cdbmake needs roughly 16 bytes of memory per record. A database cannot exceed 4 gigabytes.

file is portable across machines.

SEE ALSO

cdbdump(1), cdbget(1), cdbstats(1)