Documentation
¶
Index ¶
Constants ¶
View Source
const ( SHUTDOWN = syscall.SIGTERM RELOAD = syscall.SIGHUP SIGINT = syscall.SIGINT SIGTERM = syscall.SIGTERM SIGHUP = syscall.SIGHUP SIGUSR1 = syscall.SIGUSR1 SIGUSR2 = syscall.SIGUSR2 )
Signals
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closer ¶
type Closer interface {
Close() error
}
Closer is the interface that wraps the basic Close method.
type Dispatcher ¶
type Dispatcher interface {
SimpleDispatcher
// OnShutdown registers handler for shutdown events
OnShutdown(func())
// OnHUP registers handler for reload (HUP) events
OnHUP(func())
// OnUSR1 registers handler for USR1 signal
OnUSR1(func())
// OnUSR2 registers handler for USR2 signal
OnUSR2(func())
// Shutdown method emits shutdown event
Shutdown()
}
Dispatcher describes structures, used to dispatch OS events to handler methods. Multiple handlers can be assigned to single event
type ExtendedDispatcher ¶
type ExtendedDispatcher interface {
Dispatcher
// RegisterCloser registers handler on shutdown event, that will
// invoke Close method on provided component
RegisterCloser(Closer)
// RegisterReloader registers handler on HUP (reload) event, that will
// invoke Reload method on provided component
RegisterReloader(Reloader)
}
ExtendedDispatcher describes dispatcher, that can provide own handlers for common usecases
func DispatchChannel ¶
func DispatchChannel(src chan os.Signal) ExtendedDispatcher
DispatchChannel returns dispatcher, built on top of provided channel
func DispatchSignals ¶
func DispatchSignals(signals ...os.Signal) ExtendedDispatcher
DispatchSignals registers listener for required signals and returns a dispatcher for that events
func NewDefaultDispatcher ¶
func NewDefaultDispatcher() ExtendedDispatcher
NewDefaultDispatcher returns a dispatcher for SIGINT, SIGTERM, SIGHUP, SIGUSR1, SIGUSR2
Click to show internal directories.
Click to hide internal directories.