Help us shape the future of Go! Take the 2026 Go Developer Survey

util

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareTempRoot added in v1.10.0

func PrepareTempRoot(root string) ([]string, error)

PrepareTempRoot gives the process an empty directory at root for its temporary files. Anything a previous process left in root, because it exited without running its deferred cleanup, is moved aside first. It returns the paths that hold leftovers, including those a previous purge did not finish, so that the caller can remove them with PurgeTempRoots. It must be called before the reconcilers start.

func PurgeTempRoots added in v1.10.0

func PurgeTempRoots(ctx context.Context, log logr.Logger, paths []string) int

PurgeTempRoots removes the given paths. A directory is emptied one entry at a time, so that ctx is honoured between entries, and then removed. Every removed path is logged at info level and every failure at error level. It stops as soon as ctx is done and returns the number of paths that were removed. Paths it did not remove are picked up by PrepareTempRoot on the next start.

func TempDirForObj added in v0.22.0

func TempDirForObj(dir string, obj client.Object) (string, error)

TempDirForObj creates a new temporary directory in the directory dir in the format of 'Kind-Namespace-Name-*', and returns the pathname of the new directory.

func TempPathForObj added in v0.22.0

func TempPathForObj(dir, suffix string, obj client.Object) string

TempPathForObj creates a temporary file path in the format of '<dir>/Kind-Namespace-Name-<random bytes><suffix>'. If the given dir is empty, os.TempDir is used as a default.

Types

This section is empty.

Jump to

Keyboard shortcuts

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