ironflowx 0.4.0

Ironflow X foundation crates in one dependency.
Documentation

foundation

crates.io docs.rs CI MSRV License: MIT

The experimental, MIT-licensed library crates that Ironflow X is built on.

Foundation crates are 0.x with no semver-stability promise.

Purpose

Every part of the engine writes through one commit path. Foundation is that path, proven on its own: the crates any Ironflow X product links to commit one environment's events durably, in order, and read them back.

Foundation's layers: the engine admits calls using credentials and the control plane, or the app's own embedder grant. The ledger durably commits events and run state. The engine and ledger use the pure execution rules, which depend on event rules and shared core types. An embedder can also call the ledger directly.

What it is

Library crates: an engine that opens on a data directory and admits calls with a key or the embedding app's own grant, the HTTP door that serves it, and the proto client that calls it. The ironflowx binary, which serves an engine over Connect, gRPC and gRPC-Web, and its CLI are built in ironflowx/ironflow from these crates (D85).

  • The first open bootstraps the engine: it mints the admin key, or takes the key you supply.
  • Create keys scoped read, write, admin or execute, read-only unless asked otherwise, with an optional expiry; list them, and revoke one.
  • Emit an event, or a batch of up to 100, with data, metadata, a version and an idempotency key; each records the key or embedder that emitted it.
  • Repeat an emit with its idempotency key and get the original event's ID back, with nothing new stored.
  • Read an event by ID, or list events newest first, as soon as any emit returns.
  • Define functions that start runs from events or direct requests. Executors claim leased runs, record step outcomes and replay them after a crash.
  • Reopen after a crash with nothing acknowledged lost, and recover an admin key from the data directory when the last one is lost.

An app that needs no keys opens a ledger directly.

Architecture

The engine is a library: a host opens it on a data directory, and every call to it carries a key, but the embedding process's own call (Engine::embedder_call), which no door carries. An embedder that needs no engine opens a ledger in a directory instead. The ironflowx binary in ironflowx/ironflow is the first host. Event rules, execution rules, credentials and core are pure; only the ledger, the control plane, the engine and a host touch disk, the clock and randomness.

A write is acknowledged once its record is fsynced, and a read sees every write acknowledged before it arrived, whoever made it:

Emit, then read your write

More diagrams (crates, modules and seams, crash recovery) and the details are in docs/architecture.md; the decisions behind them are in docs/decisions.md.

Crate Contents
ironflowx-core IDs, the environment reference, attribution, scopes, addresses, secrets, stored and event-clock time, the clock trait, error kinds
ironflowx-events event rules: what an event is and when an emit is refused
ironflowx-execution execution rules: functions, runs, claims and steps; published from 0.4
ironflowx-proto the Operations interface and its request and answer types; behind features, the proto, its wire messages and the proto client
ironflowx-cell the ledger: one environment's durable commit log and read store
ironflowx-authz credentials: the key format, and whether a key is valid and may make a call
ironflowx-store the control plane: which tenants, projects, environments and keys exist
ironflowx-operations the engine: admits every call, then runs it on the ledger or the keys
ironflowx the crates an app uses, re-exported: core, proto, cell and operations
ironflowx-doors the HTTP door a host serves an engine through; published from 0.4
ironflowx-codegen the generator: a CLI's commands, from the proto, at build time; published from 0.4

Use it

Run the binary

The ironflowx binary, its CLI and their release archives are in ironflowx/ironflow.

Embed the engine

Depend on the facade, with tokio for the runtime the engine and the ledger run on:

[dependencies]
ironflowx = "0.4"
tokio = { version = "1", default-features = false, features = ["rt"] }

The 0.4 facade re-exports core, proto, cell and operations. The engine's own crates, ironflowx-store, ironflowx-authz, ironflowx-events and ironflowx-execution, are published to satisfy the engine's dependencies.

examples/embed bootstraps an engine with a seed it wrote to disk first, emits an event, reads it back with a read-only key and sees that key's emit refused, then restarts the engine and reads the event with the seed from disk and emits as the app itself using Engine::embedder_call (Engine open). Use a fresh data directory with 0.4. Older ledger and control-plane formats are refused (changelog).

Call a served engine

Add the client feature to your ironflowx dependency to use ironflowx::proto::Client over HTTP. Use client-tls for HTTPS, with roots from the system's trust store. Both features are off by default, so an embedder can build without the HTTP stack. Engine and Client both implement Operations.

Start the ironflowx binary from ironflowx/ironflow on loopback with a fresh data directory.

ironflowx serve --listen 127.0.0.1:8080 --data-dir ./whoami-demo

Once it is ready, run the example from this checkout in another terminal.

cargo run --locked -p ironflowx --features client --example whoami -- http://127.0.0.1:8080 ./whoami-demo/admin.key

The example asks whoami and prints the calling key's ID and scopes.

MSRV / Rust version policy

All foundation crates share one minimum supported Rust version (MSRV), declared as rust-version in the workspace Cargo.toml (currently 1.100) and pinned for CI in rust-toolchain.toml.

We keep the MSRV at most one stable release behind the current stable release: the crates must build on the current stable and on the stable release immediately before it. We do not move rust-version to the newest stable the day it ships, so an embedder on the previous stable does not have to pin a new toolchain as soon as foundation moves. The MSRV is raised only in a minor release and is recorded in the changelog.