Installation
This document explains how to build, initialize, and run AeroDB Phase 0 from source.
AeroDB Phase 0 is a single-node, deterministic document database with:
- Mandatory schemas
- WAL-backed durability
- Full crash recovery
- Deterministic query planning and execution
This is infrastructure software, not a toy.
1. System Requirements¶
Operating System¶
- Linux (recommended)
- macOS (untested but should work)
Windows is not supported in Phase 0.
Rust Toolchain¶
Minimum:
Check:
If not installed:
Restart your shell after installation.
2. Clone the Repository¶
3. Build AeroDB¶
Debug build:
Release build (recommended):
Binary location:
4. Directory Layout¶
AeroDB stores all data under data_dir.
After initialization:
You must provide a config file.
5. Create Configuration¶
Create aerodb.json:
{
"data_dir": "./data",
"wal_sync_mode": "fsync",
"max_wal_size_bytes": 1073741824,
"max_memory_bytes": 536870912
}
Notes:
data_diris required- Other fields are optional
- All values become immutable after first startup
6. Initialize Database¶
Run:
This creates:
If this directory already exists, init will fail.
7. Define a Schema¶
Schemas must exist before any writes.
Create:
Example:
{
"schema_id": "user",
"schema_version": "v1",
"fields": {
"_id": { "type": "string" },
"name": { "type": "string" },
"age": { "type": "int" }
},
"indexes": ["_id", "name", "age"]
}
Rules:
_idis mandatory- All indexed fields must be declared
- Schema versions are immutable
8. Start AeroDB¶
Run:
Startup will:
- Load config
- Load schemas
- Replay WAL
- Rebuild indexes
- Verify consistency
- Enter SERVING state
On success, AeroDB waits for JSON requests on stdin.
9. Insert a Document¶
Create insert.json:
{
"op": "insert",
"schema_id": "user",
"schema_version": "v1",
"document": {
"_id": "1",
"name": "alice",
"age": 30
}
}
Send it:
echo '{"op":"insert","schema_id":"user","schema_version":"v1","document":{"_id":"1","name":"alice","age":30}}' | ./target/release/aerodb query --config aerodb.json
Expected response:
10. Query Documents¶
Create query.json:
{
"op": "query",
"schema_id": "user",
"schema_version": "v1",
"filter": {
"age": 30
},
"limit": 10
}
Run:
Example output:
11. Explain a Query¶
Returns deterministic execution plan.
12. Crash Recovery Test¶
You can simulate a crash:
- Start AeroDB
- Insert data
- Kill process (
Ctrl+Cor SIGKILL) - Restart
On restart:
- WAL is replayed
- indexes rebuilt
- data is preserved
This is mandatory behavior.
13. Common Failures¶
Missing Schema¶
→ Schema files not present or mismatched.
WAL / Storage Corruption¶
→ Database halts. Restore from backup.
AeroDB never auto-repairs.
Invalid Config¶
→ Fix config and retry.
14. Phase-0 Limitations¶
AeroDB Phase 0 does NOT support:
- HTTP server
- joins
- aggregations
- transactions
- replication
- checkpoints
- WAL truncation
- schema migrations
This is expected.
15. Next Steps¶
Recommended after installation:
- Read
BOOT.md - Read
API_SPEC.md - Read
LIFECYCLE.md
These define system guarantees.