FortDB — Fully Versioned, Thread-Safe, Hierarchical NoSQL Database Interactive Shell Usage
-
Start FortDB
$ ./fortdb fortdb started. Type 'exit' or 'quit' to quit. fortdb>
-
Supported Commands
Command Example Description load <path>load /home/me/db.fortLoad database from file get <path> [--v=<V>]get users/john/ageFetch field value (optional local version V)set <path> <value>set users/john/age 42Insert or update field delete <path>delete users/john/ageTombstone an entity list-versions <path>list-versions users/john/ageList all versions of an entity compact <path>compact users/johnRetain only latest versions, remove tombstones compact_dbcompact_dbCompact entire database save <path>save ./test/saves/db.fortSave current in-memory DB to file exit,quitexitExit the interactive shell dumpdumpPrint the entire database state to the console help,?helpShow this help message -
Key Features
- Append-only writes: SET/DELETE always append; no in-place updates.
- Hierarchical versioning: VersionNode chains at every level.
- Local versions:
uint64_tcounters track per-entity changes. - Time-travel reads: Query any historical state with
--vflag. - Atomic compaction: Background process compacts data and swaps files atomically.
- Thread-safe: RW-locks on structures and global mutex for version counter.
- Example Session
$ ./fortdb
fortdb started. Type 'exit' or 'quit' to quit.
fortdb> load db.fort
Loaded database from db.fort
fortdb> get users/alice/email
alice@example.com
fortdb> get users/alice
fields: name, age
subdocuments: children
fortdb> set users/alice/age 30
OK
fortdb> list-versions users/alice/age
v3: 30
v2: <deleted>
v1: 29
fortdb> compact users/alice
Compacted users/alice
fortdb> save db.fort
Saved database to db.fort
fortdb> exit- Getting Help
Type help at the prompt for command summaries.
- Future Plans
- Provide a live server cli for concurrent read's and writes from multiple users
- Have every write operation atomically write the database to a new file and delete old one for added crash safety