Skip to main content

Crate warpline_core

Crate warpline_core 

Source
Expand description

warpline-core — a multi-tenant WebAssembly function runtime you embed in your own app.

Hold a Runtime, publish components under (tenant, function) names and invoke them with per-call Limits. Guests get a tenant-scoped KvStore, logging and allowlisted outbound HTTP; CPU (epoch ticks), memory, output size, per-tenant concurrency and total memory are all capped, and every invocation that reaches a guest is reported to a MeterSink.

  • runtime — the Runtime facade, its config and builder.
  • kv — the KvStore trait and the in-memory MemKv.
  • meter — Usage and the MeterSink trait.
  • pg (feature postgres, on by default) — schema-isolated migrations, bearer-token auth, tenant admin and a batching MeterSink. Nothing in this crate reads environment variables or migrates implicitly.
  • types — Limits, name validation and config validators.

For a complete integration (an axum app, a Rust guest, Postgres auth and metering) see examples/storefront.

Re-exports§

pub use kv::KvError;
pub use kv::KvStore;
pub use kv::MemKv;
pub use meter::MeterSink;
pub use meter::Usage;
pub use runtime::Invocation;
pub use runtime::Runtime;
pub use runtime::RuntimeBuilder;
pub use runtime::RuntimeConfig;
pub use runtime::Staged;
pub use types::valid_name;
pub use types::ConfigError;
pub use types::Limits;
pub use wasmtime;

Modules§

kv
Per-tenant key/value store abstraction.
meter
What a completed invocation cost, and where that gets reported.
pg
Everything Postgres: migrations, bearer-token auth, tenant admin and the batching meter. Behind the postgres feature (on by default).
runtime
The Runtime facade: the one type an embedding app holds.
types
Limits and name validation, plus (crate-private) the per-invocation host context attached to the wasmtime Store.

Structs§

Bytes
A cheaply cloneable and sliceable chunk of contiguous memory.

Enums§

Error
General error for Runtime construction, GC and module loading. Non-exhaustive.
InvokeError
Why Runtime::invoke failed. Non-exhaustive.
PublishError
Why Runtime::stage or Runtime::activate failed. Non-exhaustive.

Constants§

GC_GRACE_PERIOD
Default grace period for Runtime::gc — an hour is comfortably longer than any single upload’s compile-then-persist-then point window could plausibly take, so nothing an in-flight upload has touched in the last hour is ever a GC candidate.

Functions§

digest
Hex-encoded SHA-256 of bytes — the content digest Runtime identifies a component by (Staged::digest).