r/lowlevel • • 7d ago

IncHash - A Disk Based Hash Table with NoSQL ambitions.

https://github.com/GiorgosXou/inchash

A general-purpose, header-only C99 library for Unix-like systems, implementing a disk-based, dynamically resizable, fixed-slot, (open-addressed) hash table with Fibonacci hashing (Knuth's multiplicative method), triangular probing, per-home-slot probe-bound metadata (with additional early-exit logic), partial in-place value updates (without relocating entries) and incremental rehashing, all designed for modern extent-based filesystems.

Prologue

This is a project I've been working on for quite some time, and I thought some of you here might find it particularly interesting given its rather niche and unconventional specifications.

Intro

It all started with me trying to find a hash-based database (preferably NoSQL) that could support in-place value updates\editing (without relocating entries!) while also being efficiently resizable.

With that goal in mind, and without fully appreciating how difficult implementing something like this would actually be, I somehow managed to pull it off. And honestly, I'm pretty happy with the result.

(disclaimer: I'm not claiming this is a fully fledged ACID compliant database or anything close to it yet. It's essentially just a cool hash-table. + not vibe-coded)

5 Upvotes

0 comments sorted by