Alternera. PluginWasmFramework. Runtime. Port. Binary
(alternera_plugin_wasm_framework v0.9.0)
Copy Markdown
View Source
The host program of Runtime.Port, alternera_wasm_host, built from
the package's native/alternera_wasm_host/ crate: where it is, what
it is started with, and whether it can run here.
The binary is looked for, in order, at
- the
ALTERNERA_WASM_HOST_PATHenvironment variable, a binary someone built or put in place; - the framework's
:host_pathapplication env; priv/native/<target>/alternera_wasm_hostin the package, wheremix alternera.wasm_hostputs it (Mix.Tasks.Alternera.WasmHost).
The first two are the operator's to set and are trusted as they are:
no checksum is checked (--fetch checks one for the third), only that
the file is executable (available/0), and the program runs with the
node's privileges.
The engine settings (args/1) are the same for the serving processes
and the compile process, so a module compiled by one loads in the
others: the node's ceiling per call (MemoryLimit.ceiling_mib/0), how
many instances a process may hold at once (one per nested call, the
runner's depth limit plus one) and how much of a reset instance's
memory stays resident (:keep_resident_bytes, 2 MiB).
Summary
Functions
The engine settings, after the mode's own arguments.
:ok when the binary is there and executable, else why not, in words
that name the path. Does not start it.
Whether available/0 is :ok.
The host's environment for Port.open/2. It reads its settings from its
arguments and runs tenants' modules, so it is given nothing of the node's
environment beyond what a process needs to start and write a temp file.
A fingerprint of the binary and its engine settings: a compiled module
is named by it, so a file compiled by another build or other settings
is never loaded. Kept once per path and recomputed when the settings,
the size, the modification time or the inode change, so a binary
rebuilt while the node runs gets a new one: mix alternera.wasm_host
installs by rename, a new inode even within the same second.
How many instances one process may hold at once.
The program's file name.
The binary's path; it may not exist (available/0).
The Rust target this node runs on: aarch64-apple-darwin,
x86_64-apple-darwin, x86_64-unknown-linux-gnu or
aarch64-unknown-linux-gnu; another
machine's is named as the BEAM names it.
Functions
@spec args() :: [String.t()]
The engine settings, after the mode's own arguments.
@spec available() :: :ok | {:error, String.t()}
:ok when the binary is there and executable, else why not, in words
that name the path. Does not start it.
@spec available?() :: boolean()
Whether available/0 is :ok.
The host's environment for Port.open/2. It reads its settings from its
arguments and runs tenants' modules, so it is given nothing of the node's
environment beyond what a process needs to start and write a temp file.
A fingerprint of the binary and its engine settings: a compiled module
is named by it, so a file compiled by another build or other settings
is never loaded. Kept once per path and recomputed when the settings,
the size, the modification time or the inode change, so a binary
rebuilt while the node runs gets a new one: mix alternera.wasm_host
installs by rename, a new inode even within the same second.
@spec instances() :: pos_integer()
How many instances one process may hold at once.
@spec name() :: String.t()
The program's file name.
@spec path() :: Path.t()
The binary's path; it may not exist (available/0).
@spec target() :: String.t()
The Rust target this node runs on: aarch64-apple-darwin,
x86_64-apple-darwin, x86_64-unknown-linux-gnu or
aarch64-unknown-linux-gnu; another
machine's is named as the BEAM names it.