tpt-archon

Rust

A vertically integrated storage/kernel/database stack in Rust — a no_std zero-allocation storage engine, capability-based microkernel with a unified page cache, and a GPU-opt-in SQL query engine, sharing a single zero-copy address space

0 stars0 forks0 watchers10 open issuesApache License 2.0

Languages

Rust98.7%JavaScript0.5%HTML0.4%Python0.3%Just0.1%Dockerfile0.0%
README

tpt-archon

CI License

Cratecrates.iodocs.rs
tpt-archon-corecrates.iodocs.rs
tpt-archon-bridgecrates.iodocs.rs
tpt-archon-kernelcrates.iodocs.rs
tpt-archon-relationalcrates.iodocs.rs

tpt-archon is a vertically integrated, proof-native computing stack that eliminates the boundaries between storage, operating system, and database. Built inside-out on Rust's ownership model and formal verification, it unifies the page cache, kernel memory management, and database buffer pool into a single, zero-copy address space — see spec.txt for the full design document.

Status

Early but functional across all four layered crates: each phase's core functionality is implemented and tested. A real PostgreSQL wire-protocol server (out-archon-pgwire) sits on top of tpt-archon-relational, so any Postgres client — psql, drivers, ORMs — can talk to Archon directly (see Connect with a Postgres client below); its wire-level behavior is checked against real Postgres by a comparison suite (out-archon-pgcompat, Phase 8 Track C). External verification crates (tpt-eidos-verifier, tpt-telos-*, tpt-gpu-ir-spec, all published to crates.io) are wired in via the non-published crates/out-archon-verify harness, not the shippable crates. GPU support is IR-emission only (no runtime), but now covers both the vectorized top-k scan and single-column aggregates (SUM/MIN/MAX/AVG/ COUNT) — the engine's EXPLAIN GPU path emits the TPTIR for the dominant operation. A real Linux io_uring backend exists behind an opt-in feature (tpt-archon-kernel's io-uring-backend), a real, cross-platform, read-only mmap zero-copy path exists behind another (mmap, in tpt-archon-core/-bridge/-kernel), and a writable mmap block device now exists behind mmap-write — deliberately core-crate-only (not wired into the bridge/kernel zero-copy cache) so StorageEngine's write-ahead invariant stays intact; sync (flush_range) is the durability boundary. A user-space driver framework v1 (tpt-archon-kernel::driver) also exists: an interrupt → capability-checked-IPC plumbing proven with a sandbox MockInterruptSource, gated by the new Resource::Device capability — real UIO/VFIO device wrapping and bare-metal interrupt handling remain explicit v2 follow-ups. The four shippable crates are published to crates.io. It is still not production-ready: a durable, fsync'd WAL now backs the file Database (write-ahead honored at the fsync boundary, replay + checkpoint on open — Phase 12.1), but real concurrent execution, PostgreSQL wire completeness (pg_catalog, SCRAM, TLS), constraints/ referential integrity, replication/HA, and machine-checked formal proofs all remain — see TODO.md Phase 12 for the live checklist.

PhaseCratePurposeStatus
1tpt-archon-coreno_std, zero-allocation storage engine (block device, page manager, WAL, B-Link tree)Implemented
2tpt-archon-bridgeZero-copy IPC & unified page cache traits between storage and kernelImplemented
2tpt-archon-kernelCapability-based microkernel (user-space first) with unified page cacheImplemented
3tpt-archon-relationalAI-native SQL query engine (GPU opt-in, CPU fallback)Implemented

The dependency graph is strict and one-directional:

tpt-archon-relational
    ↓
tpt-archon-kernel
    ↓
tpt-archon-bridge
    ↓
tpt-archon-core

TPT ecosystem dependencies

Archon builds on sibling TPT Solutions crates rather than reimplementing verification tooling from scratch:

  • tpt-eidos (bare repo; the tpt-eidos-verifier sub-crate) — QF_LRA solver used to prove the B-Link node-capacity / page-fit invariant.
  • tpt-telos (tpt-telos-verifier / tpt-telos-ir / tpt-telos-parser sub-crates) — formal verification of critical invariants (WAL crash consistency, MVCC serializability, scheduler deadlock-freedom). There is no standalone tpt-telos crate; those three sub-crates are the package names.
  • tpt-gpu (the tpt-gpu-ir-spec sub-crate) — a TPTIR dialect emitter (lowers an IR region to stable TPTIR text). It is not a runtime and does not execute anything. There is no tpt-gpu-primitives or tpt-gpu-runtime crate — they do not exist anywhere in the ecosystem. The GPU path in tpt-archon-relational only emits TPTIR for an external GPU backend; the CPU vector_topk remains the real executor.

These are verification/tooling deps, not runtime deps. None of them are pulled into the shippable crates. They live exclusively in the non-published crates/out-archon-verify harness, as ordinary published crates.io version requirements. See AGENTS.md and ADR 0003.

There is no tpt-zero-bytes crate (referenced in the original design doc but never built anywhere in the ecosystem); the zero-allocation I/O primitives tpt-archon-core needs are implemented directly in that crate instead.

Quick start

The fastest way to try Archon is the interactive SQL shell:

cargo run -p out-archon-sql

This drops you into a REPL where you can create tables, insert data, and run queries:

CREATE TABLE users (id INT, name TEXT, age INT);
INSERT INTO users (id, name, age) VALUES (1, 'alice', 30);
INSERT INTO users (id, name, age) VALUES (2, 'bob', 25);
SELECT name, age FROM users WHERE age >= 25 ORDER BY age;

Or run a single statement non-interactively:

cargo run -p out-archon-sql -e "SELECT 1 + 2;"

No local Rust toolchain? Build and run the REPL in Docker instead:

docker build -t archon-sql .
docker run -it archon-sql

docker-publish.yml also auto-builds and pushes this image to ghcr.io/<org>/<repo>/archon-sql on every v* release tag (and remains available via manual dispatch for an ad hoc build in between releases).

Connect with a Postgres client

Archon also speaks the real PostgreSQL wire protocol, so any Postgres client can connect to it directly instead of going through the archon-sql REPL. Start the server:

cargo run -p out-archon-pgwire --bin archon-pgwire

This listens on 127.0.0.1:5432 by default (override with the HOST/PORT env vars) and accepts unauthenticated (trust) connections. Then, from another terminal:

psql -h 127.0.0.1 -p 5432 -U postgres

Coverage is still narrower than real Postgres — see TODO.md's Phase 8 for what's supported (simple + extended query protocol, SQLSTATE errors, transactions) versus deferred (SCRAM auth, COPY, TLS, pg_catalog emulation).

Which crate should I use?

What you wantCrateExample
Embed a database in your apptpt-archon-relationalexamples/select_end_to_end.rs
Use the storage engine directlytpt-archon-coreexamples/storage_tour.rs
Run SQL interactivelyarchon-sql (package out-archon-sql, not published)cargo run -p out-archon-sql
Connect via psql/Postgres driversarchon-pgwire (package out-archon-pgwire, not published)cargo run -p out-archon-pgwire --bin archon-pgwire
Try it in a browser, no installout-archon-wasm (not published)crates/out-archon-wasm/www/ — see that crate's README to build/serve it
Use Archon from Pythonarchon-db (package out-archon-py, PyO3 bindings, not yet on PyPI)crates/out-archon-py/README.md
Embed the database from Node.jsarchon-node (crate out-archon-node, not published to crates.io -- ships to npm)crates/out-archon-node/README.md
Scaffold a new projecttemplate/cargo generate --path template
Formal-verification harnessout-archon-verify (not published)cargo test -p out-archon-verify

See docs/EXAMPLES.md for a use-case-indexed cookbook of runnable examples across all four crates.

Build

cargo build --workspace
cargo test --workspace

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.