GenDurable.Registry (gen_durable v0.1.2)

Copy Markdown View Source

Resolves {fsm_name, fsm_version} to an FSM module.

Two resolution paths:

  • Explicit registry — modules passed in :fsms are indexed by __gd_name__/0 + __gd_version__/0 in a protected ETS table. Use this when a machine has a custom :name (the fsm column is then not a module name) or to keep old :versions running (spec §8): old instances finish on their fsm_version, so the old module must stay registered.
  • Dynamic fallback — on a miss, the fsm name is interpreted as a module name (its default is inspect(module)) and accepted if that module is a GenDurable.FSM whose own name and version match the row. So a machine with the default name and a single version needs no :fsms entry at all.

Reads are an ETS lookup plus, only on a miss, a cheap module check — no GenServer call on the hot path.

Summary

Functions

Returns a specification to start this module under a supervisor.

Look up the module for {name, version} — the explicit registry first, then a dynamic resolution of name as a module. Raises NotFound if neither matches.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

fetch!(name, version)

Look up the module for {name, version} — the explicit registry first, then a dynamic resolution of name as a module. Raises NotFound if neither matches.

start_link(opts)