mirror of
https://github.com/matt-dunleavy/plugin-manager.git
synced 2025-10-05 21:16:51 +08:00

This commit introduces significant improvements and new features to the plugin manager: - Add plugin discovery system and remote repository support - Implement plugin update system with digital signature verification - Enhance plugin lifecycle hooks (PreLoad, PostLoad, PreUnload) - Improve dependency management with custom version comparison - Introduce lazy loading for optimized plugin performance - Implement comprehensive error handling and logging - Enhance concurrency safety with fine-grained locking - Add plugin statistics tracking - Remove external version comparison dependencies - Improve hot-reload functionality with graceful shutdown - Add SSH key support for remote repositories - Implement Redbean server integration for plugin repositories This update significantly improves the plugin manager's functionality, security, and performance, providing a more robust and flexible system for managing plugins in Go applications.
49 lines
927 B
Go
49 lines
927 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
pm "github.com/matt-dunleavy/plugin-manager"
|
|
)
|
|
|
|
type HelloPlugin struct{}
|
|
|
|
func (p *HelloPlugin) Metadata() pm.PluginMetadata {
|
|
return pm.PluginMetadata{
|
|
Name: "HelloPlugin",
|
|
Version: "1.0.0",
|
|
Dependencies: map[string]string{},
|
|
}
|
|
}
|
|
|
|
func (p *HelloPlugin) Init() error {
|
|
fmt.Println("HelloPlugin initialized")
|
|
return nil
|
|
}
|
|
|
|
func (p *HelloPlugin) Execute() error {
|
|
fmt.Println("Hello from HelloPlugin!")
|
|
return nil
|
|
}
|
|
|
|
func (p *HelloPlugin) Shutdown() error {
|
|
fmt.Println("HelloPlugin shut down")
|
|
return nil
|
|
}
|
|
|
|
func (p *HelloPlugin) PreLoad() error {
|
|
fmt.Println("HelloPlugin pre-load")
|
|
return nil
|
|
}
|
|
|
|
func (p *HelloPlugin) PostLoad() error {
|
|
fmt.Println("HelloPlugin post-load")
|
|
return nil
|
|
}
|
|
|
|
func (p *HelloPlugin) PreUnload() error {
|
|
fmt.Println("HelloPlugin pre-unload")
|
|
return nil
|
|
}
|
|
|
|
var Plugin HelloPlugin |