apiserverk8s.io/apiserver/pkg/util/filesystem Index | Files

package filesystem

import "k8s.io/apiserver/pkg/util/filesystem"

Index

Functions

func WatchUntil

func WatchUntil(ctx context.Context, pollInterval time.Duration, path string, eventHandler func(), errorHandler func(err error))

WatchUntil watches the specified path for changes and blocks until ctx is canceled. eventHandler() must be non-nil, and pollInterval must be greater than 0. eventHandler() is invoked whenever a change event is observed or pollInterval elapses. errorHandler() is invoked (if non-nil) whenever an error occurs initializing or watching the specified path.

If path is a directory, only the directory and immediate children are watched.

If path does not exist or cannot be watched, an error is passed to errorHandler() and eventHandler() is called at pollInterval.

Multiple observed events may collapse to a single invocation of eventHandler().

eventHandler() is invoked immediately after successful initialization of the filesystem watch, in case the path changed concurrent with calling WatchUntil().

Source Files

watchuntil.go

Version
v0.36.0 (latest)
Published
Apr 22, 2026
Platform
linux/amd64
Imports
4 packages
Last checked
4 days ago

Tools for package owners.