Documentation ¶
Index ¶
- Variables
- type Manager
- func (mng *Manager) AvailableUpdates() []structs.AvailableUpdate
- func (mng *Manager) InstallPlugin(ctx context.Context, name string) error
- func (mng *Manager) InstalledPlugins() []structs.InstalledPlugin
- func (mng *Manager) OnFetchDone(fn func(error))
- func (mng *Manager) OnUpdateAvailable(fn func([]structs.AvailableUpdate))
- func (mng *Manager) Start(ctx context.Context) error
- type PluginProvider
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnknownPlugin = errors.New("unknown plugin")
)
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages installed plugins.
func NewManager ¶
func NewManager(stateFile string, inst installer.Installer, reg PluginProvider, service pluginmanager.Service) *Manager
NewManager returns a new plugin manager that stores state information in stateFile and uses inst for plugin installations and reg for available plugin lookups.
func (*Manager) AvailableUpdates ¶
func (mng *Manager) AvailableUpdates() []structs.AvailableUpdate
AvailableUpdates returns a list of available plugin updates.
func (*Manager) InstallPlugin ¶
InstallPlugin installs a new plugin, updates the state file, registers it in the Portmaster.
func (*Manager) InstalledPlugins ¶
func (mng *Manager) InstalledPlugins() []structs.InstalledPlugin
InstalledPlugins returns a list of all installed plugins.
func (*Manager) OnFetchDone ¶
OnFetchDone registers a callback function that is invoked when the plugin provided fetched new repository data.
The provided error indicates if the fetch was successful or not.
func (*Manager) OnUpdateAvailable ¶
func (mng *Manager) OnUpdateAvailable(fn func([]structs.AvailableUpdate))
OnUpdateAvailable registers a new callback function that is executed when new updates are available.
This is only ever fired after OnFetchDone and only if fetching repositories was successful.
type PluginProvider ¶
type PluginProvider interface { Fetch() error ByName(string) (structs.PluginDesc, bool) UpdateAvailable(name, version string) (string, error) }
PluginProvider describes the minimum interface required by the manager. It's implemented by registry.Registry.