Numscript.Runtime (numscript v0.2.0)

Copy Markdown View Source

Runs requests against numscript.wasm.

The module is compiled once (load!/0, called when the application starts) and kept in :persistent_term; its SHA-256 is checked against priv/numscript.wasm.sha256 first. Requests go to a pool of live instances (an internal pool): the Go runtime inside each one starts once, so a request is just a function call.

Summary

Functions

Sends request (a map) to the interpreter and returns the decoded response.

The SHA-256 the bundled WASM must have (from priv/numscript.wasm.sha256).

Verifies and compiles the WASM module, once. Returns {engine, module}.

Path of the bundled numscript.wasm.

Functions

call(request, opts \\ [])

@spec call(map(), keyword()) :: {:ok, map()} | {:error, Numscript.Error.t()}

Sends request (a map) to the interpreter and returns the decoded response.

expected_sha256()

The SHA-256 the bundled WASM must have (from priv/numscript.wasm.sha256).

load!()

Verifies and compiles the WASM module, once. Returns {engine, module}.

wasm_path()

Path of the bundled numscript.wasm.