16-FEB-2011: A simple "append-only" database r0 (See the current copy)
A proposed API and implementation for an append-only database
- Journal (multiple concurrent writers) -- all writes go here, acts as a buffer
- Database (flat text file, looks like a log file) -- written to by single thread reading from Journal; order of inserts is not guaranteed to be the same as order of inserts into journal
- Index (binary tree of keys) -- values are kept in sorted order with a count of the number of values; values are pointers to offsets in the Database
Support disabling the journal or the index at compile time using #define AMDB_NO_JOURNAL and #define AMDB_NO_INDEX
Journal format:
- [Magic (32-bits)]
- [Header Size (HDR_SZ; 32-bits)]
- [Header (HDR_SZ * 8-bits)]:
- Tag-Length-Value
- [Tracks (NUM_TRACKS * TRACK_SIZE * 8-bits)]