GitHub Open console

Get started

Clone it, build it, and write your first durable key in about two minutes. No package manager, no config file, no dependencies to resolve.

STEP 1

Install

You need a Rust toolchain. That is the entire dependency list — Cargo.toml has an empty [dependencies] section and it stays that way.

terminalcopy
$ git clone https://github.com/Youdahe123/youdaheDB.git
$ cd youdaheDB
$ cargo build --release
   Compiling youdaheDB v0.1.0
    Finished release [optimized] target(s)
STEP 2

Try it in a shell

The binary starts an interactive shell. Every write goes to the write-ahead log and is fsynced before it is acknowledged, so an accepted write is on disk.

terminalcopy
$ cargo run
youdaheDB v0.1
commands: put <key> <value> | get <key> | delete <key> | scan | flush | compact | quit

db> put user:1 youdahe
OK
db> put user:2 ada
OK
db> get user:1
youdahe
db> delete user:2
OK
db> get user:2
(not found)
db> scan
  user:1 = youdahe

A delete writes a tombstone rather than removing anything. Inside the engine it has to stay distinguishable from a miss, or an older value sitting in an SSTable underneath would come back. At the shell, both read as (not found), and scan hides deleted keys.

STEP 3

Check that nothing gets lost

Do not take the word "durable" on faith — kill the process without a clean shutdown and watch the log replay.

terminalcopy
# in another terminal, while the REPL is running:
$ pkill -9 youdaheDB

# then start it again
$ cargo run
youdaheDB v0.1
commands: put <key> <value> | get <key> | delete <key> | scan | flush | compact | quit

db> get user:1
youdahe   ← still there after SIGKILL

Startup replays the log silently. Everything lives in data/ in the working directory: the log is a run of numbered segments (data/wal-000000.log, …), flushed tables and the MANIFEST that lists them sit beside it. Delete the folder and you start clean. This kill-and-reopen loop runs in CI on every push (#13).

STEP 4

Try the CLI prototype

Prototype A psql-style client designed ahead of the server (#21), so the command surface can be tried before the engine speaks SQL. It is scriptable, pipe-friendly, and returns real exit codes — 0 ok, 1 query error, 2 connection error.

terminalcopy
# interactive
$ ./cli/youdahedb
youdahedb=# \dt
youdahedb=# select id, email from users limit 3;

# one-shot, for scripts and CI
$ ./cli/youdahedb -c "select count(*) from orders"

# from a pipe
$ echo "select 1" | ./cli/youdahedb

# point at another node
$ ./cli/youdahedb --host 10.0.1.11 --port 8080
Sample data only, for now. The CLI speaks the HTTP API designed in web/API.md. No server implements that API yet, so it runs against in-process sample data and says so on startup. The engine itself has no SQL layer yet (#42).
STEP 5

Open the console mock-up

Mock-up The browser console designed for the finished database — SQL shell, schema, cluster nodes, ranges, transactions, LSM storage, jobs and metrics.

terminalcopy
$ python3 -m http.server 8777 --directory web
# then open http://127.0.0.1:8777/console.html

There is no server for it to connect to yet (#19), so every view shows sample data, under the 0.1-mock badge.

Open the console →

STEP 6

Use it inside your own program

The storage engine is a library first. Engine is cheap to clone and safe to share across threads; this is the same code as the crate's compiled doc example.

rustcopy
use youdaheDB::Engine;

fn main() -> std::io::Result<()> {
    // opens the dir, loads its SSTables, replays the WAL
    let db = Engine::open("./data")?;

    db.put("user:1", "youdahe")?;
    let v = db.get("user:1")?; // Some("youdahe")
    db.delete("user:1")?;

    // sorted iteration across memtable + every SSTable
    for entry in db.scan_prefix("user:")?.iter()? {
        let (k, v) = entry?;
        println!("{k} = {v}");
    }
    Ok(())
}
Not yet on crates.io. Depend on it by git path for now: youdaheDB = { git = "https://github.com/Youdahe123/youdaheDB" }.
NEXT

Where to go from here