utils

package
v0.0.343 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LockModeWrite       = "lock"
	LockModeRead        = "rlock"
	LockOutcomeAcquired = "acquired"
	LockOutcomeTimeout  = "timeout"
)

Lock observer labels: the mode of a MapMutex acquisition and its outcome.

Variables

View Source
var ContextNilError = errors.New("context is nil")

Functions

func CanonicalHash added in v0.0.135

func CanonicalHash(in []byte) (string, error)

func MergeMaps added in v0.0.199

func MergeMaps[Map ~map[K]V, K comparable, V any](m1, m2 Map, skips ...K) Map

MergeMaps merges m2 key/values into m1 without overriding existing keys

func RemoveManagedFields added in v0.0.135

func RemoveManagedFields(d metav1.Object)

func RemoveSpecificFields added in v0.0.135

func RemoveSpecificFields(d *unstructured.Unstructured, fields [][]string) error

func SetLockObserver added in v0.0.341

func SetLockObserver(f func(mode, outcome string))

SetLockObserver installs f as the process-wide lock observer; nil uninstalls it. The observer is called after the MapMutex's internal mutex is released, never under it, and may be called from any goroutine.

func ValidateCompletionAnnotation added in v0.0.75

func ValidateCompletionAnnotation(annotations map[string]string) *field.Error

func ValidateStatusAnnotation added in v0.0.75

func ValidateStatusAnnotation(annotations map[string]string) *field.Error

Types

type MapMutex added in v0.0.67

type MapMutex[T comparable] struct {
	// contains filtered or unexported fields
}

func NewMapMutex

func NewMapMutex[T comparable]() MapMutex[T]

func (*MapMutex[T]) Lock added in v0.0.67

func (m *MapMutex[T]) Lock(ctx context.Context, key T) error

func (*MapMutex[T]) RLock added in v0.0.67

func (m *MapMutex[T]) RLock(ctx context.Context, key T) error

func (*MapMutex[T]) RUnlock added in v0.0.67

func (m *MapMutex[T]) RUnlock(key T)

func (*MapMutex[T]) Unlock added in v0.0.67

func (m *MapMutex[T]) Unlock(key T)

Jump to

Keyboard shortcuts

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