system

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyServerPointer = errors.New("server pointer should not be nil")

ErrEmptyServerPointer declares error for nil pointer

View Source
var ErrNotImplemented = errors.New("this method is not implemented")

ErrNotImplemented declares error for method that isn't implemented

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check() error
}

Checker defines simple probe checkers

type Config

type Config struct {
	Grace Grace
}

Config contains system parameters

type Grace

type Grace struct {
	Period int
}

Grace contains attributes of graceful shutdown process

type Operations

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

Operations implements simplest Operator interface

func NewOperator

func NewOperator(cfg *Config, sd ...Shutdowner) *Operations

NewOperator creates operator

func (Operations) Maintenance

func (o Operations) Maintenance() error

Maintenance operation implementation

func (Operations) Reload

func (o Operations) Reload() error

Reload operation implementation

func (Operations) Shutdown

func (o Operations) Shutdown() []error

Shutdown operation

type Operator

type Operator interface {
	Reload() error
	Maintenance() error
	Shutdown() []error
}

Operator defines reload, maintenance and shutdown interface

type Shutdowner

type Shutdowner interface {
	Shutdown(context.Context) error
}

Shutdowner defines Shutdown interface

type SignalType

type SignalType int

SignalType describe

const (
	// Shutdown defines signals for shutdown process
	Shutdown SignalType = iota
	// Reload defines signals for reload process
	Reload
	// Maintenance defines signals for maintenance process
	Maintenance
)

func (SignalType) String

func (s SignalType) String() string

type Signals

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

Signals for defined processes

func NewSignals

func NewSignals() *Signals

NewSignals creates default signals

func (*Signals) Add

func (s *Signals) Add(sig os.Signal, sigType SignalType)

Add appends signal by specified type

func (*Signals) Get

func (s *Signals) Get(sigType SignalType) (signals []os.Signal)

Get signals by specified type

func (*Signals) Remove

func (s *Signals) Remove(sig os.Signal, sigType SignalType)

Remove deletes signal by specified type

func (*Signals) Wait

func (s *Signals) Wait(logger *zap.Logger, operator Operator) error

Wait needs to catch signal and do graceful shutdown

Jump to

Keyboard shortcuts

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