re_configuration

package
v1.9.14 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 10 Imported by: 0

README

Переконфигурация.

Компонент позволяет переконфигурировать приложение "на лету". Перекнофигурация осуществляется путем вызова метода ReConfiguration, у зарегестрированных объектов, после получения сигнала SIGHUP от ОС.

Компонент реализует интерфейс ReConfiguration, который доступен в контейнере объектов.

type ReConfiguration interface {
	Registration(components ...ReConfigurationComponent)
}

Метод Registration принимает слайс объектов, которые реализует интерфейс ReConfigurationComponent,

type ReConfigurationComponent interface {
	ReConfiguration(configurator configurator.Configurator) error
}

если компонент имеет метод перекнофигурации, с именем отличным от имени ReConfiguration, имеется возможность передать в метод Registration метод переконигурации обертанный в метод ReConfigurationFunc.

Проверку на изминеные параметры и саму переконифгурацию, должен выполнять зарегестрированный компонент.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Component = &app.Component{
	Constructor: app.Constructor(func(container container.Container) error {
		return container.Provides(
			NewOsSignal,
			func(osSignal *OsSignal) ReConfiguration { return osSignal },
		)
	}),
	ServeChan: app.ServeChan(func(container container.Container, isServeChan chan struct{}) error {
		return container.Invoke(func(osSignal *OsSignal, closer closer.Closer) error {
			isServeChan <- struct{}{}
			return osSignal.Process(closer.GetContext())
		})
	}),
}

Functions

This section is empty.

Types

type OsSignal

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

func NewOsSignal

func NewOsSignal(configurator configurator2.Configurator) *OsSignal

func (*OsSignal) Components

func (osSignal *OsSignal) Components() []ReConfigurationComponent

func (*OsSignal) Name added in v1.8.12

func (osSignal *OsSignal) Name() string

func (*OsSignal) Process added in v1.8.12

func (osSignal *OsSignal) Process(ctx context.Context) error

func (*OsSignal) Registration

func (osSignal *OsSignal) Registration(components ...ReConfigurationComponent)

type ReConfiguration added in v1.8.12

type ReConfiguration interface {
	Registration(components ...ReConfigurationComponent)
}

type ReConfigurationComponent added in v1.8.12

type ReConfigurationComponent interface {
	ReConfiguration(configurator configurator.Configurator) error
}

type ReConfigurationFunc added in v1.8.12

type ReConfigurationFunc func(configurator configurator.Configurator) error

func (ReConfigurationFunc) ReConfiguration added in v1.8.12

func (r ReConfigurationFunc) ReConfiguration(configurator configurator.Configurator) error

Jump to

Keyboard shortcuts

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