Yokai is an in-memory database inspired by Redis. It supports strings, numbers (as strings), and hash sets. It comes with a server written in C++23 and a REPL built with Python.
To enable persistence, we save the state of the database at regular intervals. When the server starts, we load this data.
Since we spawn a thread for each client, we need to synchronize the global database with the changes made by clients. To achieve this, we use MVCC (Multi-Version Concurrency Control).
A demo of the database can be found here
If you want to contribute you should start by forking this repo and creating a branch for the issue you want to tackle.
You should have installed on you machine the following:
- Zig 0.14.0. Static binary can be downloaded here.
- doxygen. Installation link here.
- Git-cliff. Installation link here.
- ClangFormat
- uv. Instalattion link here
When you are ready to commit make sure you use conventional commit specification.
Provides commands to build certain aspects of the project:
# It will build everything, daemon, repl, tests, docs, etc.
zig build
# Build and run the daemon
zig build run-daemon
# Run the repl
uv run python3 repl/main.py
# Build and run the tests
zig build test
# Format code
zig build format
If you add a new .cpp
file to the project make sure you add it to the
coresponding build step in build.zig
.
For example, if during the development you added a daemon/include/math.h
and
daemon/math.cpp
, you will go to build.zig > fn build_daemon(...)
and add
math.cpp
to daemon_files
.
common is a directory which provides .h
and .cpp
that implement
shared behaviour for both REPL
and DAEMON
.
daemon is a directory which contains the implementation for the DAEMON
.
repl is a directory which contains the implementation for the REPL
.
tests is a directory which contains all the project's tests.
lib is a directory which includes all library dependencies we need.