aion/internal/ffi
Raw bindings to the engine-provided aion_flow_ffi runtime module.
This module is the only place in aion_flow that declares
@external(erlang, "aion_flow_ffi", ...) functions. The Erlang module
name is the engine’s NIF registry namespace, registered by
EngineBuilder::register_nifs (AE-004) and resolved by beamr when a
compiled workflow is loaded inside an Aion engine runtime. The query
pump bindings at the bottom target aion_flow_query_pump, the plain
Erlang module shipped inside this package.
gleam build type-checks these signatures with no engine present. The
author-facing modules wrap this type-erased string boundary with typed
codecs and domain values; this module intentionally exposes only raw names,
encoded payload/config strings, handles, and Result(String, String) error
seams.
Values
pub fn await_activity_result(
correlation_id: String,
) -> Result(String, String)
pub fn await_child(child_id: String) -> Result(String, String)
pub fn cancel_timer(timer_id: String) -> Result(String, String)
pub fn collect_all(
collection_id: String,
items: List(String),
) -> Result(String, String)
pub fn collect_map(
collection_id: String,
items: List(String),
) -> Result(String, String)
pub fn collect_race(
collection_id: String,
items: List(String),
) -> Result(String, String)
pub fn continue_as_new(input: String) -> Result(Nil, String)
pub fn dispatch_activity(
name: String,
input: String,
config: String,
) -> Result(String, String)
pub fn dispatch_query(
name: String,
config: String,
) -> Result(String, String)
pub fn query_recorded_observations() -> Result(String, String)
pub fn random_int(
min: String,
max: String,
) -> Result(String, String)
pub fn receive_signal(
name: String,
config: String,
) -> Result(String, String)
pub fn register_query(
name: String,
config: String,
) -> Result(String, String)
pub fn register_query_handler(
name: String,
handler: fn(String) -> Result(String, String),
) -> Nil
Store a query handler fun in the workflow process dictionary under the
engine-contract key {aion_query_handler, Name}. The Erlang helper owns
the raw process-dictionary types; Gleam code never touches them.
pub fn reply_query(
query_id: String,
payload: String,
) -> Result(String, String)
pub fn reply_query_error(
query_id: String,
message: String,
) -> Result(String, String)
pub fn send_signal(
workflow_id: String,
name: String,
payload: String,
) -> Result(String, String)
pub fn service_query(sentinel_payload: String) -> Nil
Service one query sentinel payload (the JSON binary after the
aion_query: prefix): run the registered handler under try/catch and
reply, converting a raise or a missing handler into a typed
reply_query_error. Never crashes the workflow process.
pub fn spawn_child(
workflow_name: String,
input: String,
config: String,
) -> Result(String, String)
pub fn start_timer(
timer_id: String,
duration: String,
) -> Result(String, String)
pub fn testing_advance(
duration: String,
) -> Result(String, String)
pub fn testing_clear_observations() -> Result(String, String)
pub fn testing_observations() -> Result(String, String)
pub fn testing_register_activity_mock(
name: String,
handler: fn(String) -> Result(String, String),
) -> Result(String, String)
pub fn testing_reset() -> Result(String, String)
pub fn with_timeout(
duration: String,
operation: fn() -> Result(value, inner_error),
) -> Result(Result(value, inner_error), String)