pub struct PluginRegistry { /* private fields */ }
Expand description
Plugin registry that manages all loaded plugins
The registry is responsible for:
- Loading and registering plugins
- Discovering tools and package managers
- Managing plugin lifecycle
- Resolving plugin dependencies
Implementations§
Source§impl PluginRegistry
impl PluginRegistry
Sourcepub async fn register_plugin(&self, plugin: Box<dyn VxPlugin>) -> Result<()>
pub async fn register_plugin(&self, plugin: Box<dyn VxPlugin>) -> Result<()>
Register a plugin with the registry
This method adds a plugin to the registry and updates the internal indexes for quick tool and package manager lookup.
Sourcepub async fn unregister_plugin(&self, plugin_name: &str) -> Result<()>
pub async fn unregister_plugin(&self, plugin_name: &str) -> Result<()>
Unregister a plugin from the registry
This method removes a plugin and cleans up all associated indexes.
Sourcepub fn get_tool(&self, tool_name: &str) -> Option<Box<dyn VxTool>>
pub fn get_tool(&self, tool_name: &str) -> Option<Box<dyn VxTool>>
Get a tool by name
Returns the tool implementation if found in any registered plugin.
Sourcepub fn get_package_manager(
&self,
pm_name: &str,
) -> Option<Box<dyn VxPackageManager>>
pub fn get_package_manager( &self, pm_name: &str, ) -> Option<Box<dyn VxPackageManager>>
Get a package manager by name
Returns the package manager implementation if found in any registered plugin.
Sourcepub fn list_plugins(&self) -> Vec<String>
pub fn list_plugins(&self) -> Vec<String>
List all registered plugins
Returns a vector of plugin names currently registered.
Sourcepub fn list_tools(&self) -> Vec<String>
pub fn list_tools(&self) -> Vec<String>
List all available tools
Returns a vector of tool names from all registered plugins.
Sourcepub fn list_package_managers(&self) -> Vec<String>
pub fn list_package_managers(&self) -> Vec<String>
List all available package managers
Returns a vector of package manager names from all registered plugins.
Sourcepub fn has_tool(&self, tool_name: &str) -> bool
pub fn has_tool(&self, tool_name: &str) -> bool
Check if a tool is available
Returns true if any registered plugin provides the specified tool.
Sourcepub fn has_package_manager(&self, pm_name: &str) -> bool
pub fn has_package_manager(&self, pm_name: &str) -> bool
Check if a package manager is available
Returns true if any registered plugin provides the specified package manager.
Sourcepub fn get_plugin_info(
&self,
plugin_name: &str,
) -> Option<HashMap<String, String>>
pub fn get_plugin_info( &self, plugin_name: &str, ) -> Option<HashMap<String, String>>
Get plugin information
Returns metadata about a specific plugin if it’s registered.
Sourcepub fn get_all_plugin_info(&self) -> HashMap<String, HashMap<String, String>>
pub fn get_all_plugin_info(&self) -> HashMap<String, HashMap<String, String>>
Get all plugin information
Returns metadata for all registered plugins.
Sourcepub async fn shutdown_all(&self) -> Result<()>
pub async fn shutdown_all(&self) -> Result<()>
Shutdown all plugins
This method shuts down all registered plugins and clears the registry. It should be called when the application is shutting down.