Registry for plugin management and lookup.
Maintains a catalog of available plugins and their components. Used by the runtime to resolve component types and capabilities.
Architecture
The registry is an ETS-backed catalog that maps:
- component type (string) → plugin module
- plugin module → plugin info
- capability → [component types]
This enables fast lookup during rendering and capability negotiation.
Usage
# Register a plugin
MyApp.VideoPlugin.register()
# Look up a component's plugin
{:ok, plugin} = Dala.Plugin.Registry.lookup_component("video")
# Check capabilities
Dala.Plugin.Registry.supports_capability?(:gestures)
# Get all components with a capability
Dala.Plugin.Registry.components_with_capability(:gestures)
Summary
Functions
Returns a specification to start this module under a supervisor.
Clears all registrations.
Gets all components that support a given capability.
Gets the plugin info for a plugin module.
Checks if a component type is registered.
Gets all registered capabilities.
Lists all registered component types.
Lists all registered plugins.
Looks up the plugin for a given component type.
Registers a plugin with the runtime.
Starts the registry.
Checks if any registered component supports a given capability.
Unregisters a plugin.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Clears all registrations.
@spec components_with_capability(Plugin.capability()) :: [String.t()]
Gets all components that support a given capability.
@spec get_plugin(module()) :: {:ok, Dala.Plugin.t()} | {:error, :not_found}
Gets the plugin info for a plugin module.
Checks if a component type is registered.
@spec list_capabilities() :: [Plugin.capability()]
Gets all registered capabilities.
@spec list_components() :: [String.t()]
Lists all registered component types.
@spec list_plugins() :: [Dala.Plugin.t()]
Lists all registered plugins.
@spec lookup_component(String.t()) :: {:ok, Dala.Plugin.t()} | {:error, :not_found}
Looks up the plugin for a given component type.
Returns {:ok, plugin} if found, {:error, :not_found} otherwise.
@spec register(Dala.Plugin.t() | module()) :: :ok
Registers a plugin with the runtime.
The plugin's __plugin_info__/0 function is called to retrieve
its schema information.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the registry.
@spec supports_capability?(Plugin.capability()) :: boolean()
Checks if any registered component supports a given capability.
@spec unregister(module()) :: :ok
Unregisters a plugin.