🚀 Flux-DB is a minimalist NoSQL database built in Rust, leveraging the Log-Structured Merge Tree (LSM) algorithm for efficient data storage and high write performance. This project is an educational and experimental implementation that demonstrates how LSM trees work under the hood.
- Log-Structured Merge Tree (LSM): Uses an efficient write-optimized data structure, designed to handle high volumes of sequential writes.
- In-Memory Table: Temporarily stores recent data before flushing it to disk.
- Write-Ahead Logging (WAL): Ensures data durability and crash recovery.
- Minimalist Design: Focuses on simplicity while learning about database internals.
- Open Source: Contributions and feedback are welcome!
To get started with Flux-DB, clone the repository and build the project with Cargo:
git clone https://github.com/PAARTH2608/FluxDB.git
cd FluxDB
cargo build
After building the project, you can run the database and interact with it via the Rust API. Example usage:
use flux_db::{WAL, InMemoryTable};
use std::path::Path;
fn main() {
let wal = WAL::create_new(Path::new("data/fluxdb")).unwrap();
let mut mem_table = InMemoryTable::new();
// Insert key-value pairs
mem_table.insert(b"key1", b"value1", 12345);
mem_table.insert(b"key2", b"value2", 12346);
// Fetch a key
let record = mem_table.fetch(b"key1");
println!("{:?}", record);
}
For a detailed explanation of the LSM tree algorithm and how it powers Flux-DB, check out my blog post:
Contributions are welcome! If you want to contribute:
- Fork the repository
- Create a new branch (git checkout -b feature-branch)
- Make your changes and commit (git commit -m 'Add some feature')
- Push to the branch (git push origin feature-branch)
- Open a pull request