Skip to content

Repository files navigation

corium

A database system in the style of Datomic — immutable, time-aware, and fact-oriented, with Datalog queries and peer-local query execution — written in Rust, paired with Clojurust for EDN/Clojure data handling and database function execution.

The peer also exposes SQL through the corium-sql Rust crate, a read-only corium sql shell, and an opt-in PostgreSQL wire server with guarded autocommit DML; see the SQL interface. corium tui opens a full-screen terminal dashboard — query workbench, live store metrics, transaction feed, and schema browser; see the operations guide.

All roadmap milestones (M0–M7, through active/standby high availability) are implemented. Start with the getting-started guide, work through the MusicBrainz example for an end-to-end tour (schema, data loader, and a Clojurust query REPL over in-memory, filesystem, or Turso storage), use the operations guide for PostgreSQL-backed deployment and recovery, and see PLAN.md for current status. Design documents, the roadmap, and architecture decision records live in docs/.

Getting started

Corium builds with a recent stable Rust toolchain. From the repository root:

cargo build --workspace
cargo test --workspace

Start a local transactor (here fully in-memory, so there is nothing to clean up afterwards):

cargo run -p corium-cli -- transactor --store mem --data-dir ./corium-data \
  --listen 127.0.0.1:4334

Then, in another terminal, create a database from a schema and open the interactive query console:

cargo run -p corium-cli -- db create people --schema schema.toml
cargo run -p corium-cli -- console people

The console accepts EDN Datalog directly:

[:find ?name ?age
 :where [?e :person/name ?name]
        [?e :person/age ?age]]

The getting-started guide has the full walkthrough (schema file, other storage backends, transacting data); the MusicBrainz example is a one-command end-to-end tour.

Workspace layout

Corium is a single Cargo workspace. Dependency edges point strictly downward: corium-core at the base, the pure engine crates above it, then the async / networked crates, with corium-cli composing everything into runnable processes. Each crate has its own README.

Crate What it does
corium-core Value, sortable encoding, Datom, ids, partitions, schema model, errors
corium-index Immutable covering-index segments (EAVT/AEVT/AVET/VAET) whose leaves are the published chunks; incremental apply with structural sharing
corium-store BlobStore + RootStore traits; memory/fs/postgres/turso/s3 backends; segment cache
corium-log Durable append-only transaction log: format, append/replay, range scans
corium-tx Transaction expansion, tempid/lookup resolution, schema validation, built-in tx fns
corium-db The immutable Db value: time views, covering-index access, naming, stats
corium-query EDN Datalog compiler/planner/executor, rules, aggregates, Pull, entity API
corium-sql DataFusion SQL and autocommit mutation planning over peer-local Db values
corium-pgwire PostgreSQL wire-protocol front end for Corium SQL
corium-protocol protobuf/gRPC definitions, wire value encoding, generated tonic stubs
corium-transactor Transactor process: pipeline, indexing job, lease/HA, gRPC server, backup
corium-peer Peer library: connection, tx-report handling, segment cache, peer server
corium-client Fluent async Datomic-style API over the peer library and peer-server gRPC; typesafe Datalog/Pull builders
corium-ffi Owned, runtime-neutral facade for native language bindings
corium-jni JNI adapter that runs an in-process peer for the Java client
corium-cljrs Clojurust bindings: value conversion, corium.api, :db/fn sandbox host
corium-cli corium binary: launchers, admin commands, console, TUI, SQL shell
corium-sim Deterministic simulation harness for fault-injection tests (not published)

Language clients live under clients/; clients/python provides the shared asynchronous local/remote Python API, clients/java provides the Java API, and clients/clojure provides synchronous and core.async JVM Clojure APIs over the published Java client.

Examples

  • examples/musicbrainz — a corium port of the Datomic MusicBrainz sample: schema, a streaming data loader, and a Clojurust query REPL, with one-command scripts for in-memory, filesystem, and Turso storage.
  • examples/postgres-jdbc — a Java/Maven client that starts an in-memory transactor, loads the 20-release MusicBrainz wasm fixture, and checks SQL queries through the PostgreSQL JDBC driver.

About

A database system

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages