mirror of
https://github.com/matt-dunleavy/plugin-manager.git
synced 2025-10-30 21:56:19 +08:00
Implement major enhancements to plugin manager (v1.2.0 & v1.3.0)
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.
This commit is contained in:
@@ -2,29 +2,27 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
pm "github.com/matt-dunleavy/plugin-manager"
|
||||
)
|
||||
|
||||
type HelloPlugin struct {
|
||||
greeting string
|
||||
}
|
||||
type HelloPlugin struct{}
|
||||
|
||||
func (p *HelloPlugin) Metadata() pm.PluginMetadata {
|
||||
return pm.PluginMetadata{
|
||||
Name: "HelloPlugin",
|
||||
Version: "1.0.0",
|
||||
Dependencies: []string{},
|
||||
Name: "HelloPlugin",
|
||||
Version: "1.0.0",
|
||||
Dependencies: map[string]string{},
|
||||
}
|
||||
}
|
||||
|
||||
func (p *HelloPlugin) Init() error {
|
||||
p.greeting = "Hello, World!"
|
||||
fmt.Println("HelloPlugin initialized")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *HelloPlugin) Execute() error {
|
||||
fmt.Println(p.greeting)
|
||||
fmt.Println("Hello from HelloPlugin!")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -33,4 +31,19 @@ func (p *HelloPlugin) Shutdown() error {
|
||||
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
|
||||
Reference in New Issue
Block a user