Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DebugOut is a log.Logger for debug messages DebugOut = log.New(io.Discard, "", 0) )
Functions ¶
This section is empty.
Types ¶
type FuncRegistry ¶
type FuncRegistry struct {
// contains filtered or unexported fields
}
FuncRegistry is an aggregation of func()s that should be called during an orderly shutdown/restart. Examples include context.CancelFuncs, resource closing, etc.
func NewFuncRegistry ¶
func NewFuncRegistry(callOnce bool) *FuncRegistry
NewFuncRegistry returns an initialized Stopper
func (*FuncRegistry) Add ¶
func (s *FuncRegistry) Add(f func())
Add will append f to the list of funcs to call, if Call() is called
func (*FuncRegistry) AddOnce ¶
func (s *FuncRegistry) AddOnce(f func())
AddOnce will append f to the list of funcs to call, if Call() is called, but will only be called once, regardless of the number of Call()s.
func (*FuncRegistry) Call ¶
func (s *FuncRegistry) Call()
Call will iterate over the registered functions, calling them. Call may only be called once with effect if callOnce is true, but is safe to call multiple times, regardless.
func (*FuncRegistry) Close ¶
func (s *FuncRegistry) Close()
Close will zero out the func list, and trip the invocation breaker preventing further use