warpline_core/lib.rs
1//! warpline-core — a multi-tenant WebAssembly function runtime you embed in
2//! your own app.
3//!
4//! Hold a [`Runtime`], [`publish`](Runtime::publish) components under
5//! `(tenant, function)` names and [`invoke`](Runtime::invoke) them with
6//! per-call [`Limits`]. Guests get a tenant-scoped [`KvStore`], logging and
7//! allowlisted outbound HTTP; CPU (epoch ticks), memory, output size,
8//! per-tenant concurrency and total memory are all capped, and every
9//! invocation that reaches a guest is reported to a [`MeterSink`].
10//!
11//! - [`runtime`] — the [`Runtime`] facade, its config and builder.
12//! - [`kv`] — the [`KvStore`] trait and the in-memory [`MemKv`].
13//! - [`meter`] — [`Usage`] and the [`MeterSink`] trait.
14//! - [`pg`] (feature `postgres`, on by default) — schema-isolated migrations,
15//! bearer-token auth, tenant admin and a batching [`MeterSink`]. Nothing in
16//! this crate reads environment variables or migrates implicitly.
17//! - [`types`] — [`Limits`], name validation and config validators.
18//!
19//! For a complete integration (an axum app, a Rust guest, Postgres auth and
20//! metering) see [`examples/storefront`](https://github.com/Bunty9/warpline/tree/main/examples/storefront).
21
22#![warn(missing_debug_implementations)]
23
24mod cache;
25mod error;
26pub mod kv;
27pub mod meter;
28#[cfg(feature = "postgres")]
29pub mod pg;
30mod registry;
31pub mod runtime;
32mod sandbox;
33pub mod types;
34
35pub use cache::digest;
36pub use error::{Error, InvokeError, PublishError};
37pub use kv::{KvError, KvStore, MemKv};
38pub use meter::{MeterSink, Usage};
39pub use registry::GC_GRACE_PERIOD;
40pub use runtime::{Invocation, Runtime, RuntimeBuilder, RuntimeConfig, Staged};
41pub use types::{valid_name, ConfigError, Limits};
42
43pub use bytes::Bytes;
44pub use wasmtime;