Arduino library for querying Constant DataBase (key, value) store. Simple, 🌀 fast and portable CDB file format was developed by D. J. Bernstein.
Fast lookups: A successful lookup in a large database normally takes just two disk accesses. An unsuccessful lookup takes only one.
Low overhead: A database uses 2048 bytes, plus 24 bytes per record, plus the space for keys and data.
No random limits: cdb can handle any database up to 4 gigabytes. There are no other restrictions; records don't even have to fit into memory. Databases are stored in a machine-independent format.
Compatible storage libraries:
- official Arduino SD
- Greiman SdFat
- SdFat - Adafruit fork
- Adafruit SPIFlash,
real
uCDB
usage✈️ SoftRF.
Simple tracing for CDB format/integrity and run time file operation errors.
#define TRACE_CDB
#include "uCDB.hpp"
cdbResult open(const char *fileName, unsigned long (*userHashFunc)(const void *key, unsigned long keyLen) = DJBHash);
cdbResult findKey(const void *key, unsigned long keyLen);
cdbResult findNextValue();
int readValue();
int readValue(void *buff, unsigned int byteNum);
unsigned long recordsNumber() const;
unsigned long valueAvailable() const;
cdbResult state() const;
cdbResult close();
examples
folder contains airports.ino
Arduino IDE sketch,
Python converter airports.py
script and data files.
satcat
sketch
benchmark
sketch
uCDB
source code released into the public domain.