Next: Connections

Prev: Starting

Disk Database

Coldmud normally operates using a binary disk-based database, storing only a small number of objects in memory at any given time. This number is usually no more than the product of the cache width and the cache depth (fixed at 7 and 23 in this version).

Coldmud's database is normally stored in binary format in the file binary/objects (relative to the database directory) and in an ndbm database with the prefix binary/index. The file binary/clean exists when the database is consistent. The functions binary_dump() and shutdown() force binary database consistency.

Because ndbm databases are usually byte-order-dependent, a binary database generated by a Coldmud process on one machine cannot be guaranteed to work with a process on another machine. Binary databases are also heavily version-dependent; small changes in the internal format of an object in a new version of the server will invalidate old binary databases, even if the C-- language and the conceptual structure of a Coldmud object remain the same in the new version.

Coldmud also supports a text format for databases. The text_dump() function stores a text database dump in the file textdump. Text dumps specify the database in terms of the C-- language and a few simple directives, so they are compatible with any version of Coldmud which can understand the C-- code contained in it. Text dumps are also simple enough to be written and edited by humans, so they provide a good mechanism for distribution of core databases.

At startup time, Coldmud looks for the file binary/clean to determine if a consistent binary database exists and was generated by the same version of Coldmud as the running process. If a clean binary database exists, Coldmud will start up very quickly, pausing only to read in the root object and system object. Otherwise, Coldmud tries to read in a text dump from the file textdump. You can force the use of a text dump by simple removing the file binary/clean. Coldmud will fail to start if it cannot find a consistent binary database or a text dump.