Expand description
§flusso-schema
The front door to the configuration layer: load a flusso configuration into a validated model.
load takes the path to a flusso.toml, reads the source and sinks from it, resolves and
parses every *.schema.yml the file references, and hands back a single Config.
The format-specific crates (schema-config-toml, schema-index-yaml) and the core model
(schema-core) sit underneath. Downstream code depends only on this crate and reaches the
core types through its re-exports.
§Example
let config = schema::load("flusso.toml")?;
for (name, index) in &config.indexes {
println!("{name}: table {} ({} fields)", index.schema.table, index.schema.fields.len());
}§2-schema — config & schema loading
This group turns config files into the validated Config.
| Crate | Path | Role |
|---|---|---|
| schema | . | The front door: load() reads a flusso.toml + its *.schema.yml files into one validated Config, and re-exports the schema-core vocabulary. |
| schema-config-toml | 1-config-toml | Parses flusso.toml → neutral entities. |
| schema-index-yaml | 1-index-yaml | Parses *.schema.yml → core types. |
Each parser crate works in two stages: parse (serde → neutral entities), then convert
(entities → model). The flusso.toml → Config conversion lives in schema itself — a
composition step — so the toml parser stays free of Config.
Part of the flusso library crates.
Modules§
Structs§
- Aggregate
- Reduces rows from a related
tableto a single value — a count, sum, or extreme. Thekeyconnects the tables;filtersrestrict which rows count. - Column
- A column-backed field: the column to read, its declared type and nullability, the transforms to apply, and a default to coalesce nulls to.
- Column
Name - Compiled
- A compiled configuration: the validated
Configplus the provenance needed to read it safely. - Config
- A whole deployment: where data comes from, where it goes, and what to build.
- Connection
Url - Connection
UrlFrom Parts Builder - Use builder syntax to set the inputs and finish with
call(). - Content
Hash - Database
Schema - Field
- One field of a document: a name, optional OpenSearch mapping
optionspassed through to the index, and asourcesaying where its value comes from. A leaf field’s type is declared on its source (aColumn’sty, anAggregate’svalue_type) so the document shape is known without a database. - Field
Name - Geo
- A geographic point built from two same-row columns. Resolves to an
OpenSearch
geo_point; the document carries{ "lat": …, "lon": … }, or SQLNULLwhen either column is null (so a nullable point is absent rather than{lat: null, lon: null}, which OpenSearch would reject). - HttpUrl
- Index
- One index in a
Config, paired with whether it is built on this run. - Index
Mapping - A fully-resolved mapping for one index: every field typed and ready for a sink to translate into its native mapping format.
- Index
Name - Index
Schema - The shape of a single search document: a root table and the fields built from its columns and related tables.
- Join
- Folds rows from a related
tableinto the document. Thekindnames the relationship — which side carries the key, and whether one row or many fold in;filters,order_by, andlimitnarrow and shape the rows that come back. - Mapping
- OpenSearch mapping.
mapping_typeis required; all other properties are passed through as-is. - Null
Check Filter is_null/is_not_null— no value operand.- Opensearch
Sink - Per-backend configuration for an OpenSearch destination. The
Sinkenum that selects between this andStdoutSinkis a composition concern and lives in theschemacrate; the backend sinks read these settings directly. - OrderBy
- RawFilter
- RawFilter
Value - Resolved
Field - One field within an
IndexMapping: the document key it lands under, its resolvedMapping(themapping_typeis always present), whether the value can be null, and the fields nested under it forobject/nestedtypes. - Schema
Path - Server
Config - Bind addresses for the two operational HTTP surfaces, as configured in
flusso.toml’s[server]table. Parsed and validated at config-read time (seeschema_config_toml’sBindAddress), so these are real socket addresses by the time they reach the binary, which layersFLUSSO_*env vars and CLI flags on top (which win). - Sink
Name - Soft
Delete Column - Soft
Delete Field - Source
- The database documents are read from. Today that’s always Postgres.
- Stdout
Sink - Table
Name - Through
- A junction table linking two sides of a many-to-many relation.
- Value
OpFilter - All other filter ops — value operand matches the operator’s arity.
Enums§
- Aggregate
Key - How an aggregate’s related rows tie back to the parent — a direct FK on the
aggregated table, or a junction table. (Joins carry their key inside
JoinKind; aggregates are inherently over-many, sobelongs_tohas no aggregate counterpart.) - Aggregate
Op - Column
Name Error - Compile
Error - Connection
Spec - How the source connection is specified: a full URL (literal or from env) or
the parts to assemble one. Resolution happens at runtime, so a configured
value can be overridden by
SOURCE_URL_VARin the running environment. - Connection
UrlError - Database
Schema Error - Direction
- Failure
Policy - What the pipeline does when a sink rejects a document at the item level —
it accepted the batch but refused a specific document (a mapping conflict, a
malformed value). Distinct from a flush-wide failure, which always stops the
run. Set globally on the config and overridable per index (both live in the
schemacrate’sConfig/Index, which assemble this policy). - Field
Name Error - Field
Source - Where a field’s value comes from. The shapes are mutually exclusive — a field
is exactly one of them — which is why this is an enum rather than a bag of
optional
column/relation/fieldsthat can contradict each other. - Filter
- A condition on which rows a join or aggregate sees. Either a structured
comparison (
NullCheckFilter,ValueOpFilter) or aRawFilterof verbatim SQL for cases the structured forms don’t cover. - Filter
Op - Filter
Value - Typed filter value — arity matches the operator.
In/NotIn→List,Between→Range, everything else →Single. - Flusso
Type - The declared type of a leaf field — the single vocabulary that bridges a Postgres column type and an OpenSearch mapping type.
- Generic
Value - The canonical value vocabulary every layer trades in — the middle type between a source and a sink.
- Http
UrlError - Index
Name Error - Join
Kind - The relationship a join expresses. The verb carries both the cardinality and — the part that matters — which table holds the key:
- Load
Error - Mapping
Type - NullOp
- RawFilter
Value Error - Relation
- How a field draws on a related table: either folding its rows in as nested
documents (
Join) or reducing them to a single value (Aggregate). - Relation
Key - A relation’s key, viewed uniformly across joins and aggregates — the three physical shapes a “these tables connect” fact can take. Traversal code (document SQL, reverse resolution) matches on this instead of caring whether the relation is a join or an aggregate.
- Resolve
Error - Scheme
- Secret
- A value resolved at runtime: either a literal baked into the config or a
reference to an environment variable read when the pipeline runs. Deferring
resolution is what lets a compiled config travel without its secrets — a
literal is carried as-is, an
Envreference carries only the variable name, and the real value is read in the environment that runs it. - Sink
- A destination for built documents: an OpenSearch cluster, or
stdoutfor inspecting output during development. - Sink
Name Error - Soft
Delete - Tells the engine to treat a row as deleted rather than present, keyed off a
mapped field or a raw column. The
optional
whennarrows it to rows matching a set of filters. - Source
Type - Table
Name Error - Text
Analysis - Which analyzer toolkit the sink wires its
flusso_*analyzers onto. - Transform
Constants§
- CONFIG_
SCHEMA - The JSON Schema describing a
flusso.tomlconfig file, embedded from this crate’sschemas/directory for editor assist and programmatic access (both re-exported fromschemaand emitted byflusso schema config). Kept in lockstep with this parser byschema’sschema_drifttest. - FORMAT_
VERSION - The artifact format version. Bumped on any incompatible change to the serialized shape so a binary refuses an artifact it can’t read, rather than misinterpreting it.
- INDEX_
SCHEMA - The JSON Schema (authored as YAML) describing a
*.schema.ymlindex file, embedded from this crate’sschemas/directory for editor assist and programmatic access (both re-exported fromschemaand emitted byflusso schema index). Kept in lockstep with this parser byschema’sschema_drifttest. - SOURCE_
URL_ VAR - The reserved environment variable that supplies / overrides the source connection URL. The source is a singleton, so one well-known name (the 12-factor convention) is unambiguous.
Traits§
Functions§
- compile
- Compile a
flusso.toml(and the schemas it references) into aCompiledenvelope. Needs neither a database nor any secret to be set — schemas are self-describing and secrets are deferred. - from_
bytes - Decode a
Compiledenvelope from MessagePack bytes, checking the format version. - http_
url - Build an
HttpUrlfrom a resolved string, mapping the validation error into aResolveError. Used by sink resolution. - load
- Loads a full
Configfrom a TOML config file atconfig_path. - load_
compiled - Read a compiled artifact from
pathand return itsConfig. - resolve_
connection_ url - Resolve the source connection URL, with
SOURCE_URL_VARas the deployment override. Precedence, highest first: - resolve_
optional - Resolve an optional sink value. Same precedence as
resolve_required, plus: when the config omits it,reservedfills it if set, otherwiseNone. - resolve_
required - Resolve a required sink value, with
reservedas the deployment override variable. Same precedence asresolve_connection_url: an explicitEnvreference wins; otherwisereservedoverrides the literal; otherwise the literal. - sink_
var_ prefix - The per-sink reserved-variable prefix: the sink’s name, uppercased, so
several OpenSearch sinks never collide (
<NAME>_OPENSEARCH_URL, …). - to_
bytes - Serialize a
Compiledenvelope to its MessagePack bytes. - validate_
index_ prefix - Check that
prefixis a legal leading fragment of an OpenSearch index name. - write
- Write a
Compiledenvelope topathas MessagePack.