<s>
cdb	B-General_Concept
,	O
short	O
for	O
"	O
constant	O
database	O
"	O
,	O
refers	O
to	O
both	O
a	O
library	B-Library
and	O
data	O
format	O
created	O
by	O
Daniel	O
J	O
.	O
Bernstein	O
.	O
</s>
<s>
cdb	B-General_Concept
acts	O
as	O
an	O
on-disk	O
associative	B-Application
array	I-Application
,	O
mapping	O
keys	O
to	O
values	O
,	O
and	O
allows	O
multiple	O
values	O
to	O
be	O
stored	O
for	O
a	O
single	O
key	O
.	O
</s>
<s>
Record	B-General_Concept
positions	O
,	O
key	O
and	O
value	O
lengths	O
,	O
and	O
hash	O
values	O
are	O
32-bit	O
quantities	O
and	O
therefore	O
must	O
fit	O
into	O
4	O
gigabytes	O
.	O
</s>
<s>
cdb	B-General_Concept
is	O
used	O
by	O
djbdns	B-Protocol
,	O
fastforward	O
,	O
mess822	O
,	O
qmail	B-Application
and	O
ucspi-tcp	B-Protocol
to	O
provide	O
highly	O
efficient	O
,	O
reliable	O
,	O
and	O
simple	O
data	O
access	O
.	O
</s>
<s>
a	O
single	O
associative	B-Application
array	I-Application
)	O
in	O
a	O
single	O
computer	B-Operating_System
file	I-Operating_System
.	O
</s>
<s>
It	O
consists	O
of	O
three	O
parts	O
:	O
a	O
fixed-size	O
header	O
,	O
data	O
,	O
and	O
a	O
set	O
of	O
hash	B-Algorithm
tables	I-Algorithm
.	O
</s>
<s>
Determine	O
at	O
which	O
hash	B-Algorithm
table	I-Algorithm
and	O
slot	O
this	O
record	B-General_Concept
should	O
be	O
located	O
.	O
</s>
<s>
Test	O
the	O
indicated	O
slot	O
in	O
the	O
hash	B-Algorithm
table	I-Algorithm
.	O
</s>
<s>
If	O
the	O
slot	O
is	O
empty	O
,	O
the	O
record	B-General_Concept
does	O
not	O
exist	O
.	O
</s>
<s>
If	O
the	O
slot	O
's	O
hash	O
matches	O
the	O
key	O
's	O
hash	O
,	O
seek	O
to	O
the	O
record	B-General_Concept
.	O
</s>
<s>
The	O
record	B-General_Concept
is	O
not	O
in	O
this	O
slot	O
.	O
</s>
<s>
Proceed	O
to	O
the	O
next	O
slot	O
,	O
wrapping	O
around	O
to	O
the	O
beginning	O
of	O
the	O
hash	B-Algorithm
table	I-Algorithm
if	O
necessary	O
.	O
</s>
<s>
The	O
fixed-size	O
header	O
at	O
the	O
beginning	O
of	O
the	O
database	O
describes	O
256	O
hash	B-Algorithm
tables	I-Algorithm
by	O
listing	O
their	O
position	O
within	O
the	O
file	O
and	O
their	O
length	O
in	O
slots	O
.	O
</s>
<s>
The	O
records	O
are	O
followed	O
by	O
a	O
set	O
of	O
256	O
hash	B-Algorithm
tables	I-Algorithm
of	O
varying	O
lengths	O
.	O
</s>
<s>
Since	O
zero	O
is	O
a	O
valid	O
length	O
,	O
there	O
may	O
be	O
fewer	O
than	O
256	O
hash	B-Algorithm
tables	I-Algorithm
physically	O
stored	O
in	O
the	O
database	O
,	O
but	O
there	O
are	O
nonetheless	O
considered	O
to	O
be	O
256	O
tables	O
.	O
</s>
<s>
Hash	B-Algorithm
tables	I-Algorithm
contain	O
a	O
series	O
of	O
slots	O
,	O
each	O
of	O
which	O
contains	O
a	O
hash	O
value	O
and	O
a	O
record	B-General_Concept
offset	O
.	O
</s>
<s>
The	O
official	O
cdb	B-General_Concept
library	B-Library
code	O
is	O
public	O
domain	O
:	O
the	O
individual	O
source	O
files	O
are	O
marked	O
as	O
such	O
,	O
and	O
are	O
also	O
available	O
in	O
the	O
public	O
domain	O
djbdns	B-Protocol
package	O
.	O
</s>
<s>
However	O
,	O
the	O
rest	O
of	O
the	O
cdb	B-General_Concept
package	O
used	O
to	O
be	O
license-free	B-License
software	I-License
,	O
meaning	O
it	O
must	O
be	O
distributed	O
verbatim	O
.	O
</s>
<s>
The	O
unusual	O
licensing	O
and	O
simplicity	O
of	O
the	O
format	O
has	O
prompted	O
others	O
to	O
re-implement	O
the	O
library	B-Library
and	O
release	O
it	O
under	O
more	O
common	O
terms	O
,	O
such	O
as	O
Michael	O
Tokarev	O
's	O
TinyCDB	B-General_Concept
library	B-Library
,	O
available	O
under	O
the	O
public	O
domain.There	O
have	O
been	O
a	O
few	O
reimplementations	O
that	O
remove	O
the	O
4GiB	O
limit	O
on	O
key/value	O
size	O
,	O
however	O
those	O
modifications	O
are	O
not	O
compatible	O
with	O
the	O
original	O
format	O
.	O
</s>
<s>
In	O
2009	O
,	O
all	O
of	O
cdb	B-General_Concept
was	O
put	O
in	O
the	O
public	O
domain	O
.	O
</s>
<s>
Notably	O
,	O
the	O
creator	O
of	O
cdb	B-General_Concept
does	O
not	O
intend	O
for	O
cdb	B-General_Concept
to	O
be	O
used	O
as	O
a	O
shared	O
library	B-Library
.	O
</s>
<s>
This	O
differs	O
from	O
virtually	O
all	O
similar	O
dbm-like	O
databases	O
,	O
such	O
as	O
Berkeley	B-Language
DB	I-Language
.	O
</s>
