FlashDB: Database for Flash

An ultra-lightweight embedded database. More...

Detailed Description

An ultra-lightweight embedded database.

See also
http://armink.gitee.io/flashdb/

This package provides a Key-Value database and a Time series database that can be used with a MTD or a file system backend.

It is recommended to use the use the MTD backend for performance reasons, but if you have a filesystem anyway or want to store the database as a file there is also a VFS backend that can be used instead.

MTD Backend

To enable the MTD backend, select the flashdb_mtd module.

FlashDB can only use a single MTD device. To assign a MTD device for FlashDB to use, call

fdb_mtd_init(MTD_0);
#define MTD_0
MTD device for the 8 MByte QSPI Flash.
Definition: board.h:68

FlashDB allows for multiple partitions on the device. They have to configured at compile time:

CFLAGS += -DFAL_PART0_LABEL=\"part0\"
CFLAGS += -DFAL_PART0_LENGTH=8*1024
CFLAGS += -DFAL_PART1_LABEL=\"part1\"
CFLAGS += -DFAL_PART1_LENGTH=4*1024

The partition names have to be used in fdb_kvdb_init() / fdb_tsdb_init().

VFS Backend

To enable the VFS Backend, select the flashdb_vfs module.

Here instead of partitions, FlashDB uses directories to store the data. The directory names are used instead of the partition names in fdb_kvdb_init() / fdb_tsdb_init() and you have to enable file mode by calling

bool file_mode = true;
fdb_kvdb_control(&kvdb, FDB_KVDB_CTRL_SET_FILE_MODE, &file_mode);

for the Key-Value database and

bool file_mode = true;
fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_SET_FILE_MODE, &file_mode);

for the time-series database.

Key-Value database

To enable the Key-Value database, select the flashdb_kvdb module.

For use of the FlashDB API, refer to the FlashDB documentation.

Time series database

To enable the Key-Value database, select the flashdb_tsdb module.

For use of the FlashDB API, refer to the FlashDB documentation.

Files

file  fal_cfg.h
 Flash Abstraction Layer partition configuration.