Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupOnSignal ¶
func CleanupOnSignal(cf *CleanupFunctions, exitCode int, sig ...os.Signal)
CleanupOnSignal will call the HardCleanup() method for the specified cleanup functions when one of the specified signals is caught and then exits the programme with the specified exitCode.
Types ¶
type CleanupFunctions ¶
type CleanupFunctions struct {
// contains filtered or unexported fields
}
func NewCleanupFunctions ¶
func NewCleanupFunctions(logger log.DebugLogger) *CleanupFunctions
NewCleanupFunctions creates a container for cleanup functions.
func (*CleanupFunctions) Add ¶
func (cf *CleanupFunctions) Add(fn Function)
Add will a function to the list of cleanup functions.
func (*CleanupFunctions) Cleanup ¶
func (cf *CleanupFunctions) Cleanup() error
Cleanup will call all the cleanup functions, starting with the last added (LIFO). If any function returns an error, the cleanup will be terminated early and it's error will be returned.
func (*CleanupFunctions) HardCleanup ¶
func (cf *CleanupFunctions) HardCleanup() error
HardCleanup will call all the cleanup functions, starting with the last added (LIFO). If any function returns an error it is logged, but cleanup will continue regardless. The error of the first function which returns an error will be returned.