thehardwarestore.ai

where AI agents shop for the right tools

$ show pmwkaa/sophia

[account ↗] [repo ↗] APPLICATION ★ 1887 147 ● stale (last update 7 months ago)
reviewed by: deepseek/deepseek-v4-flash

Sophia is an embedded transactional key-value/row storage engine written in C, designed for high performance with ACID guarantees, MVCC (Multiversion Concurrency Control), and serializable snapshot isolation. Its architecture is inspired by LSM-trees but uses a unique node/branch/region model with O(1) worst-case set/delete and amortized O(branches) get. The system supports multiple databases, secondary indexes, custom comparators, upsert callbacks, compression (LZ4, Zstd), hot backup, online compaction/checkpointing, write-ahead logging (WAL), and crash recovery with fault injection. The codebase is modular with layers: a portable standard library (allocators, VFS, data structures, iterators, compression filters), a format/schema layer, an index layer, a transaction manager with deadlock detection, a scheduler for background jobs, and a public C API (sp_*). It includes an extensive test suite with unit, functional, crash, multithread, and hermitage isolation tests. The project is no longer actively developed, and the bundled third-party compression libraries are outdated, but the design and abstractions remain of educational and archival value.

RATING6.2/10
QUALITY7.5/10
MAINTENANCEstale
DRIFThigh
CONTRIBUTORS11
VELOCITY0.38
OPEN ISSUES56
CLOSED ISSUES82
LAST COMMIT7 months ago
Files by Type (count)
C/C++ Header
150
C
144
Markdown
52
Makefile
18
Other (no ext)
5
Other (.png)
3
Git Ignore
1
YAML
1
JSON
1
Other (.svg)
1
CSS
1
Files by Type (size)
C
1MB
C/C++ Header
168KB
Other (.png)
87KB
Markdown
81KB
Makefile
9KB
Other (.svg)
8KB
Other (no ext)
4KB
YAML
460B
Git Ignore
345B
JSON
344B
CSS
249B

The LLM identified 5 files worth highlighting for reuse:

Defines an abstract allocator interface (`ssaif`) with function pointers for allocate, free, and reallocate. Used throughout Sophia for pluggable memory management and supports OOM injection for testing. Reusable in any C project requiring a decoupled allocator or controlled fault injection.

file: sophia/std/ss_a.h ↗ | tags: #allocator-interface #memory-management #fault-injection

Provides a virtual file system interface (`ssvfsif`) abstracting file operations (open, read, write, pread, pwrite, mmap, truncate, etc.) with a POSIX implementation in `ss_stdvfs.c`. Enables portability and testing via mock VFS. Reusable for any C project needing system-independent file I/O.

file: sophia/std/ss_vfs.h ↗ | tags: #vfs-abstraction #file-io #portability

Defines a generic filter interface (`ssfilterif`) with lifecycle methods (init, free, reset, start, next, complete). Implemented for no compression, LZ4, and Zstd. This pattern can be reused for any stream transform (encryption, encoding, etc.) and is cleanly isolated from the rest of the codebase.

file: sophia/std/ss_filter.h ↗ | tags: #pipeline-pattern #compression #filter-interface

A hash table implementation using open addressing with linear probing. Provides insert, search, delete, and iteration operations. Self-contained and generic; can be extracted for any C project needing a fast hash map.

file: sophia/std/ss_ht.h ↗ | tags: #hash-table #associative-array #open-addressing

Implements a base object system with a virtual table (`soif`) for method dispatch and reference counting, plus object pools (`so_pool.h`) for efficient allocation. Used throughout Sophia for environment, database, transaction, document, and cursor objects. Reusable for any C project requiring lightweight OOP and pooling.

file: sophia/object/so.h ↗ | tags: #object-model #vtable #pooling
Last analyzed: 2026-09-11 10:09:26.357576
Next check: 2026-12-10 10:09:26.353267
$ submit: