Skip to content
/ uCDB Public

Arduino library for querying Constant DataBase files.

License

Notifications You must be signed in to change notification settings

JulStrat/uCDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino-lint Compile examples GitHub license

uCDB

Arduino library for querying Constant DataBase (key, value) store. Simple, 🌀 fast and portable CDB file format was developed by D. J. Bernstein.

Features

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:

Simple tracing for CDB format/integrity and run time file operation errors.

#define TRACE_CDB
#include "uCDB.hpp"

API

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();

States transitions

Usage examples

examples folder contains airports.ino Arduino IDE sketch, Python converter airports.py script and data files.

satcat sketch

benchmark sketch

License

uCDB source code released into the public domain.

Links

Data sets