globwatcher

package
v0.0.0-...-0a43815 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("glob watching is closed")

ErrClosed is returned when attempting to get changed globs after glob watching has closed

Functions

This section is empty.

Types

type GlobWatcher

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

GlobWatcher is used to track unchanged globs by hash. Once a glob registers a file change it is no longer tracked until a new hash requests it. Once all globs for a particular hash have changed, that hash is no longer tracked.

func New

func New(logger hclog.Logger, repoRoot turbopath.AbsoluteSystemPath, cookieWaiter filewatcher.CookieWaiter) *GlobWatcher

New returns a new GlobWatcher instance

func (*GlobWatcher) GetChangedGlobs

func (g *GlobWatcher) GetChangedGlobs(hash string, candidates []string) ([]string, error)

GetChangedGlobs returns the subset of the given candidates that we are not currently tracking as "unchanged".

func (*GlobWatcher) OnFileWatchClosed

func (g *GlobWatcher) OnFileWatchClosed()

OnFileWatchClosed implements FileWatchClient.OnFileWatchClosed

func (*GlobWatcher) OnFileWatchError

func (g *GlobWatcher) OnFileWatchError(err error)

OnFileWatchError implements FileWatchClient.OnFileWatchError

func (*GlobWatcher) OnFileWatchEvent

func (g *GlobWatcher) OnFileWatchEvent(ev filewatcher.Event)

OnFileWatchEvent implements FileWatchClient.OnFileWatchEvent On a file change, check if we have a glob that matches this file. Invalidate any matching globs, and remove them from the set of unchanged globs for the corresponding hashes. If this is the last glob for a hash, remove the hash from being tracked.

func (*GlobWatcher) WatchGlobs

func (g *GlobWatcher) WatchGlobs(hash string, globsToWatch hash.TaskOutputs) error

WatchGlobs registers the given set of globs to be watched for changes and grouped under the given hash. This method pairs with GetChangedGlobs to determine which globs out of a set of candidates have changed since WatchGlobs was called for the same hash.

Jump to

Keyboard shortcuts

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