system
v0.1.8
Documentation
pkg.go.dev ↗Variables
ErrEmptyServerPointer
var ErrEmptyServerPointer = errors.New("server pointer should not be nil")
ErrEmptyServerPointer declares error for nil pointer.
ErrNotImplemented
var ErrNotImplemented = errors.New("this method is not implemented")
ErrNotImplemented declares error for method that isn't implemented.
Types
Checker
type Checker interface {
Check() error
}
Checker defines simple probe checkers.
Config
type Config struct {
Grace Grace
}
Config contains system parameters.
Grace
type Grace struct {
Period int
}
Grace contains attributes of graceful shutdown process.
Operations
type Operations struct {
// contains filtered or unexported fields
}
Operations implements simplest Operator interface.
NewOperator
func NewOperator(cfg *Config, sd ...Shutdowner) *Operations
NewOperator creates operator.
Operations.Maintenance
func (o Operations) Maintenance() error
Maintenance operation implementation.
Operations.Reload
func (o Operations) Reload() error
Reload operation implementation.
Operations.Shutdown
func (o Operations) Shutdown() []error
Shutdown operation.
Operator
type Operator interface {
Reload() error
Maintenance() error
Shutdown() []error
}
Operator defines reload, maintenance and shutdown interface.
Shutdowner
type Shutdowner interface {
Shutdown(context.Context) error
}
Shutdowner defines Shutdown interface.
SignalType
type SignalType int
SignalType describe
Shutdown (3 declarations)
const ( // Shutdown defines signals for shutdown process. Shutdown SignalType = iota // Reload defines signals for reload process. Reload // Maintenance defines signals for maintenance process. Maintenance )
SignalType.String
func (s SignalType) String() string
Signals
type Signals struct {
// contains filtered or unexported fields
}
Signals for defined processes.
NewSignals
func NewSignals() *Signals
NewSignals creates default signals.
Signals.Add
func (s *Signals) Add(sig os.Signal, sigType SignalType)
Add appends signal by specified type.
Signals.Get
func (s *Signals) Get(sigType SignalType) (signals []os.Signal)
Get signals by specified type.
Signals.Remove
func (s *Signals) Remove(sig os.Signal, sigType SignalType)
Remove deletes signal by specified type.
Signals.Wait
func (s *Signals) Wait(logger *zap.Logger, operator Operator) error
Wait needs to catch signal and do graceful shutdown.