LemonCore. EngineInfoBridge
(lemon_core v0.1.0)
View Source
Optional bridge to the engine runtime, without compile-time coupling.
Channels and the control plane need three things that only the engine runtime
(:lemon_gateway in the reference runtime) can answer: the resume syntax its
custom engines accept, its transport registry for ops introspection, and any
full-replacement gateway config it holds. Before this bridge each caller
reached back with a hardcoded :"Elixir.LemonGateway.*" atom; now the engine
runtime configures itself here at boot and callers ask core.
This is LemonCore.RouterBridge's pattern pointed the other way: a
configured implementation module per capability, runtime dispatch, and a
documented degraded answer when nothing is configured.
LemonCore.EngineInfoBridge.configure(
engine_registry: LemonGateway.EngineRegistry,
transport_registry: LemonGateway.TransportRegistry,
gateway_config: LemonGateway.Config
)Every function answers {:error, :unavailable} (or the documented empty
value) when its capability is unconfigured, unloadable, or not running, so a
runtime without an engine still serves channel messages and ops queries.
Summary
Functions
Whether a capability is configured, loadable, and (for registries) running.
Current bridge configuration.
Registers implementation modules. Unspecified capabilities are left alone.
Enabled transports as {id, module} pairs.
Extracts a resume token using the engine runtime's own resume syntax.
A full-replacement gateway config map, or :none.
The module implementing a transport id.
The module registered for capability, or nil.
Engine ids known to the engine runtime.
Transport ids the engine runtime has configured.
Whether the registry process behind capability is alive.
Types
@type capability() :: :engine_registry | :transport_registry | :gateway_config
@type config() :: %{optional(capability()) => module()}
Functions
@spec available?(capability()) :: boolean()
Whether a capability is configured, loadable, and (for registries) running.
@spec config() :: config()
Current bridge configuration.
Registers implementation modules. Unspecified capabilities are left alone.
Enabled transports as {id, module} pairs.
@spec extract_resume(String.t()) :: {:ok, LemonCore.ResumeToken.t()} | :none
Extracts a resume token using the engine runtime's own resume syntax.
:none when no engine runtime is configured — callers fall back to the
canonical LemonCore.ResumeToken syntax.
@spec gateway_config() :: {:ok, map()} | :none
A full-replacement gateway config map, or :none.
The engine runtime may hold a config that replaces the canonical one wholesale (used by tests and by embedders that drive the gateway directly).
The module implementing a transport id.
@spec impl(capability()) :: module() | nil
The module registered for capability, or nil.
@spec list_engines() :: [String.t()]
Engine ids known to the engine runtime.
@spec list_transports() :: {:ok, [term()]} | {:error, :unavailable}
Transport ids the engine runtime has configured.
@spec running?(capability()) :: boolean()
Whether the registry process behind capability is alive.