armink / FlashDB

An ultra-lightweight database that supports key-value and time series data | 一款支持 KV 数据和时序数据的超轻量级数据库
Apache License 2.0
1.91k stars 434 forks source link

LittleFS implementation #130

Open GiulioDallaVecchia opened 2 years ago

GiulioDallaVecchia commented 2 years ago

Hi FlashDB developer team,

I'm having a look about this DB. It seams very good and during this days I'm trying to use it with my STM32 board. I'm wondering if I can add the possibility to use this DB with LittleFS file system.

What do you think about?

Best regards,

Giulio Dalla Vecchia

armink commented 2 years ago

Yes. The FlashDB can run on filesystem mode. You can see the linux demo.

GiulioDallaVecchia commented 2 years ago

Hi @armink,

Thanks for the reply! I've written the functions to work with littleFS file system (open, read, write, erase). I suggest you to create a porting file for each file system, otherwise fdb_file.c become very long and complex.

Best regards,

Giulio Dalla Vecchia

armink commented 2 years ago

The FDB filesystem mode support POSIX and LIBC API mode. Most filesystems support this type of API. So there is no need to modify the fdb_file.c file.

GiulioDallaVecchia commented 2 years ago

In many embedded systems LittleFS is used as file system. It is very useful also because support static allocation. Unfortunately, it's not POSIX or LIBC API mode. Another file system that is used in embedded application is SPIFFS that is no POSIX or LIBC compliance.

Best regards, GDV

armink commented 2 years ago

Maybe you can try the RT-Thread RTOS. It has a Virtual File System and support POSIX or LIBC API mode.

The littlefs and FlashDB as software package on the RT-Thread. There is no need to modify the code when using these two packages on any hardware platform.