BreakingPeer-reviewable proof: ACID, BASE and all three letters of CAP. At the same time.Read our paper
Docs/Guides

Rust storage engine

AbyssDB’s storage engine has been rewritten in Rust. The crate lives in rust/abyss-core and is embedded in the Go server as a WebAssembly module.

Why Rust

  • Memory safety. abyss-core is #![forbid(unsafe_code)], and the entire Rust workspace contains zero unsafe blocks.
  • Performance. Over 1,000,000 writes per second on a single core.
  • Zero-cost abstractions. Every operation costs exactly zero.
  • Fearless concurrency. The engine holds no data that could race.

Using it

abyssdb --storage-engine rust
abyssdb serve --storage-engine rust
abyss=> SHOW STATS;
NOTICE:  storage engine .......... abyss-core (Rust 🦀, via WebAssembly)
NOTICE:  storage device .......... wasm://abyss-core

Every AbyssDB feature (encryption, sharding, NullRaft, 2PC, AbyssChain) works unchanged on top of the Rust engine.

How it is embedded

Go server ──► internal/rustengine ──► wazero (pure-Go WebAssembly runtime)
                                          └─► abyss_rs.wasm (14 KB)
                                                 └─► abyss-wasm ──► abyss-core
  • rust/abyss-core: the engine. A Device trait with a Void implementation, statistics, and an ADF encoder that is byte-compatible with the Go implementation. On native targets it writes to the operating system’s storage device; on wasm32 it runs entirely in linear memory, without using any.
  • rust/abyss-wasm: the WebAssembly ABI. The host never passes a raw pointer for Rust to dereference. Rust allocates a staging buffer per device and returns its address; the host copies data in and asks Rust to write the staged bytes.
  • internal/rustengine: embeds the module with go:embed, instantiates it once per process with wazero, and registers the rust storage engine. Every device opens its own handle inside the module.

No cgo, no shared libraries, no C toolchain. The Rust engine is sandboxed and works on every platform Go supports, including inside the WebAssembly builds of AbyssDB itself.

ExportSignaturePurpose
abyss_open() -> u32Open a device, return its handle
abyss_buffer(handle, len) -> u32Address of a staging buffer of len bytes
abyss_write(handle, len) -> u32Write len staged bytes
abyss_read_all(handle) -> u32Full scan; returns bytes read
abyss_fsync(handle)Make writes durable
abyss_close(handle)Close the device

Building

make rust          # cargo build to wasm32 and re-embed (go generate ./internal/rustengine)
cargo test --manifest-path rust/Cargo.toml
cargo run --release --manifest-path rust/Cargo.toml --bin abyss-bench
abyss-core (Rust 🦀) on /dev/null
writes ........... 1033216
throughput ....... 1032755 writes/s
bytes written .... 35129344
unsafe blocks .... 0

Requires Rust with the wasm32-unknown-unknown target (rustup target add wasm32-unknown-unknown). The prebuilt module is committed, so building the Go server does not require Rust.