Modules
The Elixir runner SDK — the runner-as-handle surface over flz_core, the
runtime every Flezha SDK runs on. A runner reaches its controller one way,
over UDS (transport: :uds, the default) or QUIC (transport: :quic),
wherever the controller runs: in this BEAM, on this machine or on another.
A handle accumulates its declared factory set with no connection or process;
start/1 claims the process-wide runner slot (a named singleton) and
connects; run/1 is start/1 then await_termination/1. Authoring and
connection failures are named error tuples returned at the call site (never a
raise) and propagate through a pipe. child_spec/1 wraps the same sequence for
a host application's supervision tree.
The graph-builder token handed to channels/1. Openers (input/input_with),
edge transforms (map/filter/flat_map/key_by), consumers
(into/into_named/output/output_with/call,
merge with from, and route_latest/route_latest_named), per-edge knobs
(named/on_full/retry_max/retry_backoff_ms) and keyed (output
identity on the plugin wire the handle reaches). Fan-out is handle reuse, or
branch over a list of arms. The effectively-once tier is a class setting
(Flezha.SDK.Relay), not a builder call.
Administering the namespace this runner's connection proved, from ordinary
application code. Sending to a relay is not here: it is
Flezha.SDK.send/5.
The invocation context handed to Tasklet.run/3. use Flezha.SDK.Tasklet
imports the functions below, so a tasklet writes emit(ctx, value) and
complete(ctx, result); apply/3 is not imported, since it would shadow
Kernel.apply/3, and a use tasklet never calls it: its defchange
recorders do.
The one error this SDK answers anything Flezha refuses with: a stable code
spelled family.snake, a class, a plain message, the details the
message names, and a hint naming the next command when there is one.
Running a declared relay graph in this process, with no controller.
One value a graph released on a declared output, carrying the bytes the
output's serializer produced and the metadata a deployed run would have put
on the wire: on a keyed/1 output the flz.cell, flz.seq and flz.key
stamps.
A merged subscription under construction, built by Flezha.SDK.ChannelBuilder.merge/1:
one tasklet fed by two or more source streams, each with the mapping that
lifts its value into the merged input.
A relay class, declared with use (see __using__/1), which defines
this behaviour's zero-arity callbacks from its options and imports the channel
builder. The author writes the graph in channels/1, a DAG of Tasklets,
Channels and Cells, or the one tasklet's run/3 of the §5 short form.
One outcome of a Flezha.SDK.ChannelBuilder.call/3, as its Response channel
delivers it: the request the call end wrote (its bytes), the result
({:ok, answer} with the answer read by the call's decode:, or
{:error, %Flezha.SDK.Error{}}, a missed deadline being call.timeout),
the callee's instance id as target, and created, true when this call
started the callee.
The single-cell tasklet Flezha.SDK.ChannelBuilder.route_latest/4 expands to:
every key seen on the traffic stream receives each distinct document once, on
that key's own next traffic item, as a {key, document} pair.
Tasklet-requested spawn of a steps instance: the request a tasklet makes
with Flezha.SDK.Ctx.spawn_steps/4, the handle it gets back at once, and
what the controller's answer resolves to.
The state block and defchange: §3's change derivation, in Elixir.
A builder-scoped stream handle. Carries the channel it flows from and the
chain it is currently appending links to; the links themselves live in the
builder's record, so the handle is a cursor and nothing more. Immutable:
reusing a handle in two into/output calls fans out, and a handle with no
chain yet opens a fresh one. Valid only inside channels/1.
A tasklet: one processing stage of a relay's graph, run once per
input and declared with use.
Run one tasklet as the dispatcher runs it, with no controller and no relay.
What one invocation produced: result (:ok, or the {:error, reason}
run/3 or on_timer/3 answered or raised), the values it emitted, the
changes it recorded and the timer operations it made, in call order.
The firing Flezha.SDK.Tasklet.on_timer/3 receives: the timer's kind and
the scheduled_at timestamp its registration answered, the pair
Flezha.SDK.Ctx.cancel_timer/3 takes.