Skip to content

dobleuber/PixieKV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PixieKV: A Simple Key-Value Store in Rust

PixieKV is a lightweight, no_std compatible key-value store written in Rust. It is designed to be a simple and efficient storage solution for embedded systems and other resource-constrained environments.

Features

  • Set and get values
  • Delete values
  • Save and load from file
  • No_std compatible
  • Persistent storage using LittleFS
  • Generic value types (supports any type that implements Serialize and Deserialize)
  • Fixed-size storage with compile-time checks
  • Database integrity validation using CRC32 hashing

Implementation

PixieKV is implemented using a heapless::FnvIndexMap as the underlying data structure. This allows for efficient lookups and inserts while maintaining a fixed-size storage that's suitable for embedded systems.

The key-value store is designed to be simple, efficient, and easy to use in no_std environments. It uses the LittleFS file system for persistent storage, allowing data to be saved and loaded from flash memory or other storage mediums.

Usage

use pixiekv::PixieKV;

let mut store = PixieKV::default();

store.insert("key", "value");

let value = store.get("key");

store.remove("key");

store.save_to_file("database.db");

let loaded_store = PixieKV::load_from_file("database.db");

Prerequisites

Installing QEMU

For running emulated tests on ARM Cortex-M targets, you need to install QEMU:

Ubuntu/Debian Linux

sudo apt update
sudo apt install qemu-system-arm

macOS

Using Homebrew:

brew install qemu

Using MacPorts:

sudo port install qemu

Windows

  1. Download QEMU from the official website: https://www.qemu.org/download/#windows
  2. Run the installer and follow the installation wizard
  3. Add QEMU to your system PATH:
    • Open "Environment Variables" in System Properties
    • Add the QEMU installation directory (usually C:\Program Files\qemu) to the PATH variable

Alternatively, using Chocolatey:

choco install qemu

Or using Scoop:

scoop install qemu

ARM GNU Toolchain

Install the ARM cross-compilation toolchain:

Ubuntu/Debian Linux

sudo apt update
sudo apt install gcc-arm-none-eabi

macOS

Using Homebrew:

brew install arm-none-eabi-gcc

Windows

  1. Download ARM GNU Toolchain from: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
  2. Install the "arm-none-eabi" variant for your Windows version
  3. Add the toolchain bin directory to your system PATH (usually C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\<version>\bin)

Alternatively, using Chocolatey:

choco install gcc-arm-embedded

Rust ARM Target

Install the ARM Cortex-M target for Rust:

rustup target add thumbv7m-none-eabi

Run tests

cargo test

Run examples

cargo run --example std_example

Run emulated tests

cargo run --target thumbv7m-none-eabi --release

License

MIT

About

This is a simple key-value store written in Rust for embedded devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published