APBCDB

Download Latest Version.
APBCDB is a constant key-value database library. That means:

Advantages

Performance

Benchmarked as follows: The performance goes down as the number of keys in the database increases:
# KEYSLOOKUPS/SEC
10k1.8M
100k779k
1M684k

How to use APBCDB

General

Creating a DB

apbcdb_writer w;
int rc;

rc = apbcdb_begin_write(&w, "phonebook.dat");

rc = apbcdb_add_entry(&w, strlen("Bob Smith"), "Bob Smith",
                          strlen("408.921.9191"), "408.921.9191");

rc = apbcdb_add_entry(&w, strlen("Jen Rapp"), "Jen Rapp",
                          strlen("714.334.5543"), "714.334.5543");

rc = apbcdb_end_write(&w);
/* this creates phonebook.dat.idx; both files must be present to read */

Reading a DB

apbcdb_reader r;
int rc;
char val[0x400];
uint vallen;

rc = apbcdb_ropen(&r, "phonebook.dat");
vallen = sizeof(val);
rc = apbcdb_get(&r, "Bob Smith", strlen("Bob Smith"), val, &vallen);
/* now val contains Bob's phone number, and vallen contains the
 * phone number's length */
rc = apbcdb_rclose(&r);

Download

Latest Version

asher@wildsparx.com