modulesloader

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

modules-loader

Загрузчик динамических Go-модулей из каталога ./modules.

Установка

go get github.com/sudzekai-web-os/modules-loader

Использование

Загрузчик получает фабрику логгеров, исполнитель команд и реестр HTTP-обработчиков:

loader := modulesloader.NewModulesLoader(
	loggerFactory,
	executor,
	registry,
)

if err := loader.LoadModules(); err != nil {
	return err
}

fmt.Println(loader.GetLoadedModules())

LoadModules ищет файлы с расширением .so в ./modules. Каждый плагин должен экспортировать символ Module, реализующий abstractions.IModule. При ошибке отдельный модуль пропускается, а информация записывается в лог.

Один файл можно загрузить напрямую через Load(path). GetLoadedModules возвращает имена и версии успешно инициализированных модулей.

Для динамической загрузки используется стандартный пакет Go plugin; поддержка зависит от платформы и сборки Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModulesLoader

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

func NewModulesLoader

func NewModulesLoader(
	loggerFactory abstractions.ILoggerFactory,
	executor abstractions.IExecutor,
	registry abstractions.IHandlersRegistry) *ModulesLoader

func (*ModulesLoader) GetLoadedModules

func (loader *ModulesLoader) GetLoadedModules() (result []string)

func (*ModulesLoader) Load

func (loader *ModulesLoader) Load(path string) error

func (*ModulesLoader) LoadModules

func (loader *ModulesLoader) LoadModules() error

Jump to

Keyboard shortcuts

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