cleanup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Steps

type Steps []func() error

Steps performs deferred cleanup on condition that an error was returned in the caller. This simplifies code where earlier steps need to be undone if a later step fails. It is not currently resilient to panics as this library is not expected to panic.

func (*Steps) Add

func (fns *Steps) Add(fn func() error)

Add appends the given cleanup function to those that will be called if an error occurs.

func (*Steps) Unwind

func (fns *Steps) Unwind()

Unwind calls the cleanup funcions in LIFO order. It panics if any of them return an error as failure during recovery is itself unrecoverable.

Jump to

Keyboard shortcuts

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