GameServer.Hooks.DynamicRpcs (GameServer v1.0.509)
Runtime registry for dynamic RPC function names exported by hook plugins.
Goal
Allow hook plugins to expose additional callable function names without
defining them as exported Elixir functions (eg. without def my_fn/1).
The intended pattern is:
- Plugin implements
after_startup/0and returns a list of maps describing which dynamic RPC names should be callable. - Plugin implements
rpc/2(orrpc/3) to handle these names at runtime. GameServer.Hooks.PluginManager.call_rpc/4falls back to the registry when the requested function is not exported.
Export format
after_startup/0 may return a list like:
[
%{hook: "my_dynamic_fn"},
%{"hook" => "other_fn", "meta" => %{...}}
]Required:
hook(string): the callable function name.
Optional:
meta(map): arbitrary metadata.
Names are validated to contain only letters, digits, and underscores.
Note: this registry is in-memory and is rebuilt on plugin reload.
Summary
Types
Functions
@spec allowed?(plugin_name(), hook_name()) :: boolean()
@spec ensure_table!() :: :ok
@spec list_all() :: %{optional(plugin_name()) => [export()]}
@spec lookup(plugin_name(), hook_name()) :: {:ok, export()} | {:error, :not_found}
@spec register_exports(plugin_name(), any()) :: {:ok, non_neg_integer()} | {:error, term()}
@spec reset_all() :: :ok