cleanup

package
v0.2025.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func() error

cleanupFunc represents a function to be called during cleanup. It returns an error if the cleanup step fails.

type Manager

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

cleanupManager manages the stack of cleanup functions.

func NewManager

func NewManager(logger *zap.Logger) *Manager

newCleanupManager creates a new cleanup manager.

func (*Manager) Add

func (cm *Manager) Add(f Func)

add adds a function to the cleanup stack.

func (*Manager) Execute

func (cm *Manager) Execute() error

execute runs all registered cleanup functions in reverse order (LIFO). It ensures cleanup runs only once and returns the first error encountered. It also syncs the logger if provided.

Jump to

Keyboard shortcuts

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