|
| 1 | +# mini-dynamo-cpp |
| 2 | + |
| 3 | +A small C++17 client library + CLI (`dynamoctl`) for the Mini Dynamo Go cluster. |
| 4 | + |
| 5 | +This repo is designed to hit the job-posting requirements: |
| 6 | +- C++ project using **CMake** |
| 7 | +- Builds on Linux with **clang/gcc** |
| 8 | +- Runs tests under **sanitizers** in CI (ASan/UBSan) |
| 9 | +- Shows “production discipline”: retries, timeouts, tests, CI |
| 10 | + |
| 11 | +## What it does |
| 12 | +- `libdynamo_client`: C++ client that can `PUT` and `GET` keys from a Mini Dynamo cluster |
| 13 | +- `dynamoctl`: CLI for quick interaction (put/get/health) |
| 14 | + |
| 15 | +The client implements simple routing using a consistent-hash ring (primary node first), and falls back to other nodes if the primary fails. |
| 16 | + |
| 17 | +## Prereqs |
| 18 | +- CMake >= 3.20 |
| 19 | +- A C++17 compiler (clang or gcc) |
| 20 | +- libcurl development headers |
| 21 | + |
| 22 | +On Ubuntu: |
| 23 | +```bash |
| 24 | +sudo apt-get update |
| 25 | +sudo apt-get install -y cmake g++ clang libcurl4-openssl-dev |
| 26 | +``` |
| 27 | + |
| 28 | +## Build + test (Linux/macOS) |
| 29 | +```bash |
| 30 | +cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_UBSAN=ON |
| 31 | +cmake --build build -j |
| 32 | +ctest --test-dir build --output-on-failure |
| 33 | +``` |
| 34 | + |
| 35 | +## Run against your Mini Dynamo cluster |
| 36 | +Start your Go cluster (from your Go repo): |
| 37 | +```bash |
| 38 | +docker compose up -d --build |
| 39 | +``` |
| 40 | + |
| 41 | +Then from this repo: |
| 42 | +```bash |
| 43 | +./build/dynamoctl health |
| 44 | +./build/dynamoctl put hello world |
| 45 | +./build/dynamoctl get hello |
| 46 | +``` |
| 47 | + |
| 48 | +## Config |
| 49 | +By default, `dynamoctl` looks for `nodes.docker.json` in the current directory. |
| 50 | +If it doesn't exist, it falls back to `localhost:9001-9003`. |
| 51 | + |
| 52 | +You can pass a config: |
| 53 | +```bash |
| 54 | +./build/dynamoctl --config nodes.local.json put k v |
| 55 | +``` |
| 56 | + |
| 57 | +Supported formats: |
| 58 | + |
| 59 | +### Minimal JSON |
| 60 | +```json |
| 61 | +{ "vnodes": 128, "nodes": [ |
| 62 | + { "id": "n1", "host": "localhost", "port": 9001 }, |
| 63 | + { "id": "n2", "host": "localhost", "port": 9002 }, |
| 64 | + { "id": "n3", "host": "localhost", "port": 9003 } |
| 65 | +]} |
| 66 | +``` |
| 67 | + |
| 68 | +### Minimal text |
| 69 | +```txt |
| 70 | +vnodes=128 |
| 71 | +n1 localhost 9001 |
| 72 | +n2 localhost 9002 |
| 73 | +n3 localhost 9003 |
| 74 | +``` |
| 75 | + |
| 76 | +> Note: This project intentionally uses a tiny JSON parser (regex-based) for a narrow schema to keep the repo self-contained. |
| 77 | +
|
| 78 | +## What to put on your resume |
| 79 | +- “Built a C++17 client SDK + CLI for a Dynamo-style KV store; implemented consistent-hash routing, timeouts, and retries.” |
| 80 | +- “Configured CMake builds for clang/gcc; added ASan/UBSan builds in CI to catch memory and UB issues early.” |
| 81 | +- “Wrote unit tests and automated them in CI (GitHub Actions / Jenkinsfile).” |
0 commit comments