call module
This block is part of the webassembly group and was last modified in core v15.0.3.
call module v15.0.3 Runs one export of a WebAssembly module with a JSON input and answers its JSON output: rules with loops, recursion or search that a block graph cannot be (pricing or tax rules, validators, simulations, a board game's legal moves).
- module
filerequiredv15.0.3The
.wasmfile: a file pin (an uploaded or stored file of this app) or a path in the app's files. - export
valuerequiredv15.0.3The export to call: a callable export of a rual_json_v1 module, or the name a command module receives as its argument.
- input
valuev15.0.3Any value; sent as JSON. Empty sends null.
- seed
valuev15.0.3Feeds the module's random numbers. Same seed, same numbers. A wired seed that is empty is refused.
- now
numberv15.0.3The time the module reads, in milliseconds since 1970. Without it the module reads 1970.
- timeout ms
numberv15.0.3Wall-clock budget, default 100, at most 5000.
- memory mb
numberv15.0.3Memory cap in MiB, default 16, at most 256.
- output
valuev15.0.3The module's answer, decoded.
- success
conditionv15.0.3 - error
valuev15.0.3A fixed code when the call did not answer.
- error detail
objectv15.0.3The module's own error object, the trap's kind, or the message.
- duration ms
numberv15.0.3How long the call took.
Calls export of the WebAssembly module in the module file with input written as JSON, and decodes the module's JSON answer onto output (numbers as float64). Sandboxed and deterministic: the module sees its input, the seed and now, and nothing of the host : no files, network, environment or arguments (a command module gets only the export name), a wall clock fixed at now (ms since the epoch; the epoch without the pin), a monotonic clock that advances only as the module reads it, and random_get fed from the seed's stream (zeros without the pin). The same module bytes, export, input, seed and now give the same output on every node; NaN bit patterns from float arithmetic are not canonicalised. Every call gets a fresh instance: nothing carries from one call to the next. Two ABIs, detected from the module: rual_json_v1 (exports memory, rual_alloc(size i32) -> i32 and each callable export as (ptr i32, len i32) -> i64 returning ptr<<32|len of UTF-8 JSON; a reactor's _initialize runs first) and wasi_command (a WASI _start: the export name is argv[1], input on stdin, answer on stdout, exit code not 0 is an error). Only wasi_snapshot_preview1 imports are provided. input is a value, not JSON text: the text "[1]" is sent as the JSON string "[1]"; nothing is null. A seed or now pin that resolves to nothing is refused (EMPTY_SEED, EMPTY_NOW) rather than run unseeded. Limits: timeout_ms (default 100, at most 5000; never past the run's own deadline) interrupts even a tight loop; memory_mb (default 16, at most 256) caps linear memory; input and output 1 MiB each; module 16 MiB. On failure success=false, output empty and error one of: MODULE_NOT_FOUND, MODULE_INVALID, MODULE_TOO_LARGE, MODULE_LIMIT (it declares more locals, tables, table entries, functions or the like than the runner admits), EXPORT_NOT_FOUND, ABI_UNSUPPORTED, INPUT_TOO_LARGE, INPUT_NOT_JSON, OUTPUT_TOO_LARGE, OUTPUT_NOT_JSON, MEMORY_LIMIT, TIMEOUT, TRAP, WASM_BUSY (no slot on this node within the timeout), MODULE_ERROR, EMPTY_SEED, EMPTY_NOW, LIMIT_OUT_OF_RANGE, WASM_NOT_ENABLED. error_detail: with MODULE_ERROR the module's own error object (an answer {"error": {"code": …, "message": …}} and nothing else, or {exit_code, stderr} for a command that exited non-zero); with TRAP {trap, message} where trap is the kind (unreachable, out_of_bounds_memory_access, integer_divide_by_zero, stack_overflow, abi_violation, …); else {message}. duration_ms is wall time and is not deterministic. No flow pins: it runs when its output is read. Pure computation: it runs in simulations.
webassembly |
wasm |
rule engine |
module |
Version history
Introduced in v15.0.3.
Back to
webassembly Return to the main group to view all sub-groups Back to modules Return to the group to view all blocks within this group