WASIX Rust runtime
Understand thread ownership, persistent roots, local endpoints, and shutdown.
The WASIX Rust SDK owns a WebAssembly host and one PostgreSQL backend. Choose its synchronous or async API according to how your application schedules work.
Thread ownership
Oliphaunt is neither Send nor Sync and must stay on one OS thread, including close and drop.
AsyncOliphaunt owns the runtime on a dedicated thread. Calls execute in admission order, and clones share one session. Async placement changes scheduling, not SQL concurrency.
Persistent storage
Only one live owner can open a persistent database. Let the SDK manage its files; do not copy a live directory or delete locks to force a second owner.
Use the backup API for data movement. Physical restore requires matching runtime-family and format compatibility. Logical SQL is the transfer path across native/WASIX families or incompatible versions.
Local PostgreSQL endpoint
Add the optional server crate when a PostgreSQL client needs a connection string:
oliphaunt-pgwire-server = "0.2.0"use oliphaunt_pgwire_server::{DatabaseStorage, OliphauntServer};
let mut server = OliphauntServer::builder()
.storage(DatabaseStorage::Directory("./data/server".into()))
.start()?;
println!("{}", server.connection_string());
// Connect one client. Close it before closing the server.
server.close()?;The endpoint serves one connected client at a time. Configure pools with a maximum of one connection. Use AsyncOliphauntServer for async lifecycle ownership. For independent client sessions, choose the native server.
Shutdown and failures
Closing rejects new work and drains work already accepted. A terminal shutdown attempt retires the handle even when it returns an error. A validation failure before shutdown begins can leave it open; inspect the operation's result rather than assuming cleanup completed.
An async transaction dropped before settlement queues best-effort rollback. This preserves operation ordering but does not promise that rollback has finished before the calling task unwinds. Explicit transaction settlement and close make outcomes observable.
Raw response streaming
Raw callbacks receive PostgreSQL protocol chunks, not typed rows. Both placements require owned Send + 'static captures. Use a shared synchronized container when collecting mutable callback state.
A callback can return () or a typed result. A callback-only failure allows reuse only after confirmed protocol recovery. An independent database failure takes precedence and makes the session close-only. Do not re-enter the database from its callback.
Optional tools
Enable the tools feature for pg_dump and non-interactive psql. Tools exclusively own and reset the session, so session settings and prepared statements may need to be recreated afterward. See Dump and restore.