cleaner

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOnError

func CleanupOnError(ctx context.Context, c *Cleaner, err *error)

func DeleteObjectIfExistsFunc

func DeleteObjectIfExistsFunc(c client.Client, object client.Object) func(ctx context.Context) error

Types

type Cleaner

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

Cleaner is an entity that allows tracking and executing cleanup methods.

func New

func New() *Cleaner

New instantiates a new Cleaner.

func (*Cleaner) Add

func (c *Cleaner) Add(f func(ctx context.Context) error)

Add adds the given function to the cleanup stack.

Cleanup functions will be executed in reverse order.

func (*Cleaner) Cleanup

func (c *Cleaner) Cleanup(ctx context.Context) error

Cleanup runs all cleanup functions with the given context, existing on the first error occurred.

func (*Cleaner) Reset

func (c *Cleaner) Reset()

Reset removes all cleanup functions from the cleaner.

Jump to

Keyboard shortcuts

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