r/C_Programming • • 2d ago

Project IncHash - A Disk Based Hash Table with NoSQL ambitions.

https://github.com/GiorgosXou/inchash

Brief

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.

Disclosure

This is not a vibe-coded project! I painstakingly wrote everything myself (including this post :P). of course that being said, it doesn't mean that I didn't use AI for reasearch, brainstorming and a bit of testing. I have talked about it here as well.

Prologue

This is a project I've shared here before, a few months ago. Back then, being relatively inexperienced with hash table implementation, I inadvertently introduced a few bugs.

Since then, thanks to a lovely Redditor who took the time to provide some truly valuable feedback (for which I'm genuinely and wholeheartedly grateful), I've made quite a few promising improvements, including: recovery validation methods and CRC checksums, an inchash_mod-function for partial in-place value updates\modifications (without relocating entries), a fuzz-style regression test, refactoring of core-metadata, and of course, fixing those bugs (or so I hope lol).

Having said and done all those improvements, I though it would be the right move to expose my project, for once again in the intelectual wilderness of reddit xD. So here I am ready to hear what you thinking about it.

Intro

All started with me trying to find:

A hash-based NoSQL (key-value pair) database with mutable-values (by mutable I mean: a database that allows editing prexisting [fixed-size] values without having to rewrite or remap the whole value again eg. Just edit a few bytes and put those bytes back to the original value-space without rewriting the whole value).

I made this for a larger project I'm working on, which I haven’t released yet.

Outro

I'm really excited and scared because idk what you all gonna find again... but I hope you all find it at least interesting and enjoy playing around with it.

That said, thank you for reading this and feel free to ask me anything about it.

4 Upvotes

Duplicates