Crates.io | feophant |
lib.rs | feophant |
version | 0.9.0 |
source | src |
created_at | 2021-07-10 20:03:04.224721 |
updated_at | 2021-10-10 22:26:55.08513 |
description | A SQL database server written in Rust and inspired by PostreSQL |
homepage | https://feophant.com |
repository | https://github.com/chotchki/feophant |
max_upload_size | |
id | 421188 |
size | 417,409 |
A SQL database server written in Rust and inspired by PostreSQL.
We now have support for persistent storage! Not crash safe but I'm getting there!
Launch the server
./feophant
Lauch a postgres client application to test
./pgbench -h 127.0.0.1 -p 50000
./psql -h 127.0.0.1 -p 50000
Benchmark to aid in profiling
cargo instruments --bench feophant_benchmark -t time
Its kinda pointless to blindly reproduce what has already been done so I'm making the following changes to the db server design vs Postgres.
Rust's memory safety and strong type system.
Multi-threaded async design based on Tokio instead of Postgres's multi-process design.
Want to avoid vaccuum for transaction wrap around. Will try 64-bit transaction IDs but might go to 128-bit.
Replacing OIDs with UUIDv4s.
I think I've figured out what the core divergeance from Postgres that I'm interested in. I love Postgres's transactional DDLs but version controlling a schema is awful. What if I make the database server a library and your schema is code? You supply a new binary that runs as the database server and if you need to change it you just deploy the binary instead? Then the compiler can optimize out anything you don't need to run the system in your use case. The hardest part is dealing with schema changes that affect your on disk format.
How to setup modules sanely: https://dev.to/stevepryde/intro-to-rust-modules-3g8k
Reasonable application error type creation: https://github.com/dtolnay/anyhow
Library Errors: https://github.com/dtolnay/thiserror
Rust's inability to treat enum variants as a type is a HUGE pain. I end up having an enum to hold data and another enum to validate and match the sub type. The RFC to fix this was postponed indefinately.
I am explicitly striving for SQL+Driver compatibility with PostgreSQL so things such as system tables and code that handles them will be named the same. I don't think this violates their trademark policy but if I am please just reach out to me! I have also gone with a pretty restrictive license but I'm not tied to it if that is causing an issue for others who are using the code.