wasm_sup (wasm v0.1.0)

View Source

Root supervisor. What application:ensure_all_started(wasm) gets you:

wasm_sup
  |
  +-- wasm_engine          node-wide page budget and shared storage
  |
  +-- wasm_keeper          who still holds each shared resource
  |
  +-- wasm_code_slots      which generated BEAM module names are in use
  |
  +-- wasm_module_cache    compiled modules, keyed by content hash

There is deliberately no instance supervisor. An instance is owned by the process that created it, and applications put instances inside whatever process shape suits them; see docs/worker.md. wasm_engine starts first and is permanent, because it owns the page budget, so nothing may allocate memory before it exists.

The supervisor owns the holder registry, the shared store and the waiter table rather than letting their users create them. An ETS table dies with the process that created it, so a keeper that created its own registry would take every resource's accounting down with it on restart and come back believing the node held nothing, and an engine that owned the store would take away the rows that registry points at.

Summary

Functions

init/1

start_link()