Expand description
§fv-compute — the transform/compute contract
A transform is a typed function over Arrow data with a declared
capability envelope, described by a TransformManifest
(transform.toml) against one contract and executed by a pluggable TransformBackend
chosen by the manifest’s IMPL. This crate is the “define once” seam: the manifest schema and
its validation (the publish gate), the envelope and binding enforcement, the Arrow-typed
signature, the directory-per-transform registry, and the dispatch traits the backends
implement (fv-compute-wasm, fv-compute-container, or your own).
It is a library any caller embeds — a pipeline runner, a materializer, an action runtime, a
REPL — so a transform is reusable outside any one pipeline. wit/transform.wit is the same
contract for WASM components; the container protocol mirrors it for processes.
use fv_compute::{parse_and_validate, ImplKind};
let m = parse_and_validate(r#"
id = "marginPct"
version = "1.0.0"
impl = "expression"
entry = "src/expr.fvx"
[[inputs]]
columns = [{ name = "revenue", type = "float64" }, { name = "cost", type = "float64" }]
[output]
columns = [{ name = "marginPct", type = "float64" }]
"#).unwrap();
assert_eq!(m.impl_kind, ImplKind::Expression);Re-exports§
pub use capability::Binding;pub use capability::CapabilityEnvelope;pub use capability::EnvelopeViolation;pub use capability::Hardware;pub use catalog::catalog_json;pub use catalog::descriptors;pub use catalog::model_descriptors;pub use catalog::models_json;pub use catalog::FieldInfo;pub use catalog::TransformDescriptor;pub use contract::Compute;pub use contract::ComputeError;pub use contract::TransformBackend;pub use manifest::parse_and_validate;pub use manifest::ContainerProtocol;pub use manifest::ImplKind;pub use manifest::Labels;pub use manifest::LabelsRule;pub use manifest::ManifestError;pub use manifest::TransformManifest;pub use registry::standard_registry;pub use registry::Backends;pub use registry::DirRoot;pub use registry::MemoryRoot;pub use registry::RawUnit;pub use registry::RegisteredTransform;pub use registry::Registry;pub use registry::RegistryBuilder;pub use registry::RegistryError;pub use registry::RegistryIndex;pub use registry::Root;pub use runtime::Runtime;pub use runtime::RuntimeBuilder;pub use types::ColumnSpec;pub use types::FvType;pub use types::SchemaSpec;
Modules§
- capability
- The capability envelope: capabilities are declared in the manifest and
enforced by the binding. The binding (a
stream/derived compute vs an Action compute) declares which envelopes it accepts and rejects a transform that violates it — the governance boundary expressed as types, so it is checkable, not trusted. - catalog
- A catalog view over the registry (/) — the UX read-model.
- contract
- The in-engine dispatch seam. Every backend (builtin, expression, wasm
container, llm) implements
TransformBackend; the standalonefv-computelibrary is what the pipeline runner, the derived-property materializer, the Action runtime, or a REPL embeds to runtransform X@v over this Arrow batch. - manifest
- The
transform.tomlmanifest — the single self-describing unit the registry discovers. This crate defines + validates it (the publish gate); the registry discovers directories of them. Every IMPL (builtin/expression/wasm/container/llm) uses this one shape. - registry
- The registry + directory-per-transform loader.
- runtime
- One object to run transforms with.
- types
- The signature type system: a transform is a typed function over Arrow data.
Column types are base types today; value-types layer on as richer signatures later.
FvTypeis the language-neutral name in atransform.toml;to_arrow()is the binding to the engine’s Arrow line, so the contract stays authorable without an Arrow dependency in the manifest itself.
Constants§
- CONTRACT_
VERSION - The version of the contract itself (independent of any transform’s version). Bumped when the manifest shape / WIT interface changes incompatibly; lets a registry reject manifests authored against a future contract.
Functions§
- transform_
index_ payload - Build the transform-index catalogue from a
root[:root…]spec (paths relative to the current directory): every registered manifest, as JSON, under the contract version. The published contract carries a snapshot of this document and consumers of the registry assert against it, so a registry change cannot silently diverge from the contract. (Thedescriptiontext is part of that snapshot; changing it is a contract change.)