mirror of
https://github.com/matt-dunleavy/plugin-manager.git
synced 2025-10-05 14:16:52 +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,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
pm "github.com/matt-dunleavy/plugin-manager"
|
||||
)
|
||||
|
||||
@@ -9,9 +10,9 @@ type MathPlugin struct{}
|
||||
|
||||
func (p *MathPlugin) Metadata() pm.PluginMetadata {
|
||||
return pm.PluginMetadata{
|
||||
Name: "MathPlugin",
|
||||
Version: "1.0.0",
|
||||
Dependencies: []string{},
|
||||
Name: "MathPlugin",
|
||||
Version: "1.0.0",
|
||||
Dependencies: map[string]string{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +22,8 @@ func (p *MathPlugin) Init() error {
|
||||
}
|
||||
|
||||
func (p *MathPlugin) Execute() error {
|
||||
a, b := 10, 5
|
||||
fmt.Printf("Addition: %d + %d = %d\n", a, b, a+b)
|
||||
fmt.Printf("Subtraction: %d - %d = %d\n", a, b, a-b)
|
||||
fmt.Printf("Multiplication: %d * %d = %d\n", a, b, a*b)
|
||||
fmt.Printf("Division: %d / %d = %d\n", a, b, a/b)
|
||||
result := p.Add(5, 3)
|
||||
fmt.Printf("MathPlugin: 5 + 3 = %d\n", result)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -34,4 +32,23 @@ func (p *MathPlugin) Shutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MathPlugin) PreLoad() error {
|
||||
fmt.Println("MathPlugin pre-load")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MathPlugin) PostLoad() error {
|
||||
fmt.Println("MathPlugin post-load")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MathPlugin) PreUnload() error {
|
||||
fmt.Println("MathPlugin pre-unload")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MathPlugin) Add(a, b int) int {
|
||||
return a + b
|
||||
}
|
||||
|
||||
var Plugin MathPlugin
|
Reference in New Issue
Block a user