plugins

package
v0.0.0-...-69cc41d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadProgress

type DownloadProgress struct {
	// Total bytes to download
	TotalBytes int64

	// Bytes downloaded so far
	BytesDownloaded int64

	// Progress percentage (0-100)
	PercentComplete float64

	// Download speed in bytes per second
	SpeedBytesPerSecond int64

	// Estimated time remaining in seconds
	EstimatedTimeSeconds int

	// Current status (downloading, verifying, installing)
	Status string
}

DownloadProgress tracks plugin download progress

type DriverRegistry

type DriverRegistry struct {
	VMDriverAdapter      *VMDriverAdapter
	StorageDriverAdapter *StorageDriverAdapter
	NetworkDriverAdapter *NetworkDriverAdapter
}

DriverRegistry provides a central registry for all driver adapters

func NewDriverRegistry

func NewDriverRegistry(pluginManager *PluginManager) *DriverRegistry

NewDriverRegistry creates a new driver registry with all driver adapters

func (*DriverRegistry) DiscoverAllDrivers

func (r *DriverRegistry) DiscoverAllDrivers() (map[string][]string, error)

DiscoverAllDrivers discovers all drivers of all types

type MarketplaceConfig

type MarketplaceConfig struct {
	// URLs of marketplace repositories
	RepositoryURLs []string

	// Local directory for marketplace metadata
	CacheDirectory string

	// Cache expiration in hours
	CacheExpirationHours int

	// Require signature verification for plugins
	RequireSignatureVerification bool

	// Signature verification public key
	SignaturePublicKey string

	// Enable plugin auto-update
	EnableAutoUpdate bool

	// Auto-update interval in hours
	AutoUpdateIntervalHours int
}

MarketplaceConfig contains configuration for the plugin marketplace

func DefaultMarketplaceConfig

func DefaultMarketplaceConfig() MarketplaceConfig

DefaultMarketplaceConfig returns a default marketplace configuration

type MarketplacePluginInfo

type MarketplacePluginInfo struct {
	// Base plugin information
	PluginInfo

	// Download URL
	DownloadURL string

	// Size in bytes
	SizeBytes int64

	// SHA256 checksum
	Checksum string

	// Digital signature
	Signature string

	// Release date
	ReleaseDate time.Time

	// Download count
	DownloadCount int

	// Rating (0.0 to 5.0)
	Rating float64

	// Number of ratings
	RatingCount int

	// Screenshots URLs
	Screenshots []string

	// Project homepage
	Homepage string

	// Documentation URL
	DocumentationURL string

	// Support contact
	SupportContact string

	// Repository URL
	RepositoryURL string

	// Reviews
	Reviews []PluginReview

	// Pricing information
	Pricing *PluginPricing
}

MarketplacePluginInfo extends PluginInfo with marketplace-specific information

type NetworkDriverAdapter

type NetworkDriverAdapter struct {
	// contains filtered or unexported fields
}

NetworkDriverAdapter provides an adapter between the plugin system and the network drivers

func NewNetworkDriverAdapter

func NewNetworkDriverAdapter(pluginManager *PluginManager) *NetworkDriverAdapter

NewNetworkDriverAdapter creates a new network driver adapter

func (*NetworkDriverAdapter) DiscoverDrivers

func (a *NetworkDriverAdapter) DiscoverDrivers() ([]string, error)

DiscoverDrivers discovers all network driver plugins

func (*NetworkDriverAdapter) GetDriver

func (a *NetworkDriverAdapter) GetDriver(name string) (interface{}, error)

GetDriver returns a network driver by name

type PluginInfo

type PluginInfo struct {
	// Unique identifier for the plugin
	ID string

	// Human-readable name
	Name string

	// Version of the plugin
	Version string

	// Author information
	Author string

	// Description of what the plugin does
	Description string

	// License information
	License string

	// Compatibility information (e.g., "v1.0+")
	Compatibility string

	// Tags for categorization and search
	Tags []string

	// Dependencies on other plugins
	Dependencies []string

	// Path to the plugin on disk
	Path string
}

PluginInfo contains metadata about a plugin

type PluginInstance

type PluginInstance struct {
	// Plugin metadata
	Info PluginInfo

	// The loaded plugin
	Plugin *plugin.Plugin

	// Extracted symbols (function pointers, etc.)
	Symbols map[string]plugin.Symbol

	// Instance-specific state
	State map[string]interface{}

	// Whether the plugin is enabled
	Enabled bool

	// Error encountered during loading, if any
	LoadError error
}

PluginInstance represents a loaded plugin

type PluginManager

type PluginManager struct {
	// contains filtered or unexported fields
}

PluginManager handles the discovery, loading, and lifecycle of plugins

func NewPluginManager

func NewPluginManager(config PluginManagerConfig) *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) DisablePlugin

func (pm *PluginManager) DisablePlugin(id string) error

DisablePlugin disables a specific plugin

func (*PluginManager) DiscoverPlugins

func (pm *PluginManager) DiscoverPlugins() ([]PluginInfo, error)

DiscoverPlugins searches for plugins in the configured paths

func (*PluginManager) EnablePlugin

func (pm *PluginManager) EnablePlugin(id string) error

EnablePlugin enables a specific plugin

func (*PluginManager) ExecuteHook

func (pm *PluginManager) ExecuteHook(hookName string, args ...interface{}) []interface{}

ExecuteHook executes all registered handlers for a specific hook

func (*PluginManager) GetInterfaceImpl

func (pm *PluginManager) GetInterfaceImpl(interfaceName string) []interface{}

GetInterfaceImpl returns all implementations of a specific interface

func (*PluginManager) GetPlugin

func (pm *PluginManager) GetPlugin(id string) (*PluginInstance, bool)

GetPlugin returns a plugin by ID

func (*PluginManager) ListPlugins

func (pm *PluginManager) ListPlugins() []*PluginInstance

ListPlugins returns a list of all loaded plugins

func (*PluginManager) LoadAllPlugins

func (pm *PluginManager) LoadAllPlugins() error

LoadAllPlugins loads all plugins from the configured paths

func (*PluginManager) LoadPlugin

func (pm *PluginManager) LoadPlugin(path string) (*PluginInstance, error)

LoadPlugin loads a specific plugin by path

func (*PluginManager) Shutdown

func (pm *PluginManager) Shutdown() error

Shutdown gracefully stops all plugins

func (*PluginManager) SortPluginsByDependencies

func (pm *PluginManager) SortPluginsByDependencies() ([]string, error)

SortPluginsByDependencies sorts plugins based on their dependencies

type PluginManagerConfig

type PluginManagerConfig struct {
	// Paths to search for plugins
	Paths []string

	// Whether to validate dependencies
	ValidateDependencies bool

	// Whether to auto-enable plugins after loading
	AutoEnable bool

	// Plugin load timeout in seconds
	LoadTimeoutSeconds int

	// Whether to skip plugins with errors
	SkipErrorPlugins bool
}

PluginManagerConfig contains configuration for the plugin manager

func DefaultPluginManagerConfig

func DefaultPluginManagerConfig() PluginManagerConfig

DefaultPluginManagerConfig returns a default configuration

type PluginMarketplace

type PluginMarketplace struct {
	// contains filtered or unexported fields
}

PluginMarketplace provides a centralized repository for discovering and installing plugins

func NewPluginMarketplace

func NewPluginMarketplace(config MarketplaceConfig, pluginManager *PluginManager) (*PluginMarketplace, error)

NewPluginMarketplace creates a new plugin marketplace

func (*PluginMarketplace) CheckForUpdates

func (pm *PluginMarketplace) CheckForUpdates() (map[string]string, error)

CheckForUpdates checks for updates to installed plugins

func (*PluginMarketplace) DownloadPlugin

func (pm *PluginMarketplace) DownloadPlugin(pluginID string, progressCallback func(*DownloadProgress), autoEnable bool) error

DownloadPlugin downloads a plugin from the marketplace

func (*PluginMarketplace) GetDownloadProgress

func (pm *PluginMarketplace) GetDownloadProgress(pluginID string) (*DownloadProgress, error)

GetDownloadProgress returns the progress of an active download

func (*PluginMarketplace) GetPluginDetails

func (pm *PluginMarketplace) GetPluginDetails(pluginID string) (*MarketplacePluginInfo, error)

GetPluginDetails returns detailed information about a specific plugin

func (*PluginMarketplace) ListAvailablePlugins

func (pm *PluginMarketplace) ListAvailablePlugins() ([]MarketplacePluginInfo, error)

ListAvailablePlugins returns a list of available plugins from the marketplace

func (*PluginMarketplace) RefreshCache

func (pm *PluginMarketplace) RefreshCache() error

RefreshCache updates the cache of available plugins from marketplace repositories

func (*PluginMarketplace) SearchPlugins

func (pm *PluginMarketplace) SearchPlugins(query string, category string, tags []string) ([]MarketplacePluginInfo, error)

SearchPlugins searches for plugins based on criteria

func (*PluginMarketplace) SubmitPluginReview

func (pm *PluginMarketplace) SubmitPluginReview(pluginID string, username string, rating float64, text string) error

SubmitPluginReview submits a review for a plugin

func (*PluginMarketplace) UpdatePlugin

func (pm *PluginMarketplace) UpdatePlugin(pluginID string, progressCallback func(*DownloadProgress), autoEnable bool) error

UpdatePlugin updates a plugin to the latest version

type PluginPricing

type PluginPricing struct {
	// Whether the plugin is free
	IsFree bool

	// One-time price in USD
	PriceUSD float64

	// Subscription pricing
	SubscriptionPriceUSD float64

	// Subscription period (monthly, yearly)
	SubscriptionPeriod string

	// Whether there's a trial period
	HasTrial bool

	// Trial period in days
	TrialDays int
}

PluginPricing represents pricing information for a plugin

type PluginReview

type PluginReview struct {
	// User who left the review
	Username string

	// Rating (0.0 to 5.0)
	Rating float64

	// Review text
	Text string

	// Date of the review
	Date time.Time
}

PluginReview represents a user review for a plugin

type StorageDriverAdapter

type StorageDriverAdapter struct {
	// contains filtered or unexported fields
}

StorageDriverAdapter provides an adapter between the plugin system and the storage drivers

func NewStorageDriverAdapter

func NewStorageDriverAdapter(pluginManager *PluginManager) *StorageDriverAdapter

NewStorageDriverAdapter creates a new storage driver adapter

func (*StorageDriverAdapter) DiscoverDrivers

func (a *StorageDriverAdapter) DiscoverDrivers() ([]string, error)

DiscoverDrivers discovers all storage driver plugins

func (*StorageDriverAdapter) GetDriver

func (a *StorageDriverAdapter) GetDriver(name string) (interface{}, error)

GetDriver returns a storage driver by name

type VMDriverAdapter

type VMDriverAdapter struct {
	// contains filtered or unexported fields
}

VMDriverAdapter provides an adapter between the plugin system and the VM drivers This allows VM drivers to be loaded dynamically as plugins

func NewVMDriverAdapter

func NewVMDriverAdapter(pluginManager *PluginManager) *VMDriverAdapter

NewVMDriverAdapter creates a new VM driver adapter

func (*VMDriverAdapter) DiscoverDrivers

func (a *VMDriverAdapter) DiscoverDrivers() ([]string, error)

DiscoverDrivers discovers all VM driver plugins

func (*VMDriverAdapter) GetDriver

func (a *VMDriverAdapter) GetDriver(name string) (interface{}, error)

GetDriver returns a VM driver by name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL