Raxol.Core.Runtime.Plugins.CommandRegistry (Raxol v0.2.0)
View SourceManages commands registered by plugins using an ETS table.
Provides functions to register, unregister, and look up commands.
Summary
Functions
Looks up the handler {module, function, arity} for a command name and namespace.
Creates a new ETS table for the command registry.
Registers a command provided by a plugin.
Unregisters a command.
Unregisters all commands associated with a specific module.
Types
Functions
@spec lookup_command(table_name(), namespace(), command_name()) :: {:ok, command_entry()} | {:error, :not_found}
Looks up the handler {module, function, arity} for a command name and namespace.
@spec new() :: table_name()
Creates a new ETS table for the command registry.
Returns the name of the created table.
@spec register_command( table_name(), namespace(), command_name(), module(), atom(), integer() | nil ) :: :ok | {:error, :already_registered}
Registers a command provided by a plugin.
Args:
table
: The ETS table name.command_name
: The name the command will be invoked by.module
: The plugin module implementing the command.function
: The function within the module to call.arity
: The arity of the function.
Returns :ok
or {:error, :already_registered}
.
@spec unregister_command(table_name(), namespace(), command_name()) :: :ok
Unregisters a command.
@spec unregister_commands_by_module(table_name(), module()) :: :ok
Unregisters all commands associated with a specific module.
Useful when a plugin is unloaded.