modules package - github.com/mythicalltd/featherwings/modules - Go Packages

modules

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles registration and lifecycle of modules

func NewManager

func NewManager() *Manager

NewManager creates a new module manager

func (*Manager) Disable

func (m *Manager) Disable(ctx context.Context, name string) error

Disable disables a module by name

func (*Manager) Enable

func (m *Manager) Enable(ctx context.Context, name string) error

Enable enables a module by name

func (*Manager) Get

func (m *Manager) Get(name string) (Module, bool)

Get retrieves a module by name

func (*Manager) List

func (m *Manager) List() []Module

List returns all registered modules

func (*Manager) LoadModuleState

func (m *Manager) LoadModuleState(name string) (enabled bool, configJSON string, err error)

LoadModuleState loads module state and config from database

func (*Manager) Register

func (m *Manager) Register(module Module) error

Register registers a module with the manager

func (*Manager) RestoreModules

func (m *Manager) RestoreModules(ctx context.Context, serverManager interface{}) error

RestoreModules restores all enabled modules from database

func (*Manager) SaveModuleConfig

func (m *Manager) SaveModuleConfig(name string, config interface{}) error

SaveModuleConfig saves module configuration to database

type Module

type Module interface {
	// Name returns the unique identifier for this module
	Name() string

	// Description returns a human-readable description of what this module does
	Description() string

	// Enabled returns whether the module is currently enabled
	Enabled() bool

	// Enable starts the module and makes it active
	// Dependencies can be passed via context values if needed
	Enable(ctx context.Context) error

	// Disable stops the module and makes it inactive
	Disable(ctx context.Context) error

	// GetConfig returns the current configuration for the module
	GetConfig() interface{}

	// SetConfig updates the module's configuration
	SetConfig(config interface{}) error

	// ValidateConfig validates the provided configuration
	ValidateConfig(config interface{}) error
}

Module represents a pluggable module that can be enabled/disabled

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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