Fireweed
Fireweed is the data plane for Snorri and Cayce: queues and tables for short-lived, scale-out workflow data, changed through a small typed DSL and run as plain SQL.
A consumer describes its data in a schema document: queues, tables,
typed fields, indexes and named reads. It changes that data with
programs: lists of typed statements (insert, claim, settle,
renew, update, delete, assert, select, read, pause,
resume) that run as one transaction. Both are YAML or JSON.
An executor creates real tables and indexes from the schema and runs each statement as one SQL statement over them. The database chooses rows by index, orders writers with row locks and decides with its clock when work is due. The executor keeps nothing in the process between calls.
- ADR-027: the decision and the owner's rulings.
- API-008: the DSL reference and the PostgreSQL executor's rules.
Crates
| Crate | What it is |
|---|---|
fireweed-dsl |
Schema and program documents, and the checker that resolves a program against a schema. |
fireweed-dsl-postgres |
The PostgreSQL 18 executor: apply_schema, get_schema, execute, execute_batch and sweep. |
fireweed-umf |
Space schemas as UMF core 0.10 documents with the fireweed.space extension (API-009). |
fireweed-dsl-local |
The SQLite and Turso executor: the same functions over one database per space on local disk, with the log optionally shipped to S3 (feature s3). |
All four are on crates.io:
[]
= "0.35"
= "0.35"
= "0.35" # only for UMF schema documents
= "0.35" # only for the in-process SQLite/Turso executor
Releases are cut by pushing a tag vX.Y.Z from main; see
CHANGELOG.md and .github/workflows/release.yml.
Example
A schema:
version: 1
queues:
work:
max_attempts: 5
fields:
campaign:
A program that enqueues two items, and one that claims them:
request_id: enqueue-1
issued_at:
statements:
- insert:
request_id: claim-1
issued_at:
statements:
- claim:
The claim returns each item's id and lease token. A later program
settles them:
request_id: settle-1
issued_at:
statements:
- settle:
From Rust:
let schema: Schema = from_yaml?;
apply_schema.await?;
let program: Program = from_yaml?;
let response = execute.await?;
Development
Prerequisites: rustup (the repository selects Rust
1.99.0) and PostgreSQL 18. docker compose up -d postgres starts one on
port 55432.
FIREWEED_PG_TEST_URL=postgres://fireweed:fireweed@127.0.0.1:55432/fireweed
Without FIREWEED_PG_TEST_URL the executor's tests skip.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option. Contributions are issues only; see CONTRIBUTING.md.