xref: /netbsd-src/external/bsd/nsd/dist/doc/NSD-DATABASE (revision d83a80ee7fb31190352cf1f781441e06ca6a86db)
1*d83a80eeSchristosNSD 4.0 DATABASE FORMAT.
2*d83a80eeSchristos
3*d83a80eeSchristosThe NSD 4.0 database format is different from NSD 2 and NSD 3.
4*d83a80eeSchristos
5*d83a80eeSchristosIt stores RRs, but in a way that they can be edited without leaking space.
6*d83a80eeSchristosThe file contains a 'buddy-system-style' 'malloc' of chunks.  Pointers are
7*d83a80eeSchristosoffsets from the start of the file.  For every pointer the reverse is
8*d83a80eeSchristoskept track of, so that chunks can be moved to a new position.  Free space
9*d83a80eeSchristosis reused, and (gradually) moved to the end to shorten the file.
10*d83a80eeSchristos
11*d83a80eeSchristosIt is about 23x larger than the NSD3 format and about 3x to 6x slower
12*d83a80eeSchristosto read and write a full database.  But you can use a tree to fetch a
13*d83a80eeSchristosparticular item at log(N) cost, and update a single item at log(N) cost.
14*d83a80eeSchristos
15*d83a80eeSchristosTherefore, adding a zone or removing a zone does not need a new compile
16*d83a80eeSchristosof the nsd database, but can be performed by editing the database.
17*d83a80eeSchristos
18*d83a80eeSchristosThe file format is endian-dependent, and uses 64bit file offsets.
19*d83a80eeSchristos
20*d83a80eeSchristosThe file chunk format is defined in udb.h.
21*d83a80eeSchristosthe tree for lookups is defined in udbradtree.h.
22*d83a80eeSchristosThe rrsets and zone format is defined in udbzone.h.
23