fsnotify

package
v0.0.0-...-ebb807c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

This is a copy paste from Cue because they (very reasonably) decided to make it internal.

Documentation

Index

Constants

View Source
const (
	Chmod  = fsnotify.Chmod
	Create = fsnotify.Create
	Remove = fsnotify.Remove
	Rename = fsnotify.Rename
	Write  = fsnotify.Write
)

Provide access to the underlying fsnotify ops.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchedRecursiveWatcher

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

BatchedRecursiveWatcher is an instance of a recursive watcher that batches events. Create a new BatchedRecursiveWatcher via NewBatchedRecursiveWatcher.

func NewBatchedRecursiveWatcher

func NewBatchedRecursiveWatcher(dir, gittoplevel string, batchWindow time.Duration, opts ...Option) (*BatchedRecursiveWatcher, error)

NewBatchedRecursiveWatcher creates a new batched watcher. A BatchedRecursiveWatcher's Events are batched into windows of at most batchWindow duration. Furthermore, if gittoplevel is supplied, events received during git operations are batched until the end of the git operation. This can mean that batch time windows can be less than batchWindow when a git operation starts before a time window expires. It can also mean that a batch captures events over a time period greater than batchWindow, when a git operation exceeds this duration.

func (*BatchedRecursiveWatcher) Close

func (bw *BatchedRecursiveWatcher) Close() error

Close shuts down the watcher, by removing all watches and closing the Events channel.

func (*BatchedRecursiveWatcher) Errors

func (bw *BatchedRecursiveWatcher) Errors() <-chan error

func (*BatchedRecursiveWatcher) Events

func (bw *BatchedRecursiveWatcher) Events() <-chan []fsnotify.Event

type Event

type Event = fsnotify.Event

type Option

type Option option

Option is used to further configure a Watcher or BatchedWatcher.

func Debug

func Debug(w io.Writer) Option

Debug configures debug-level logging via the io.Writer w.

type RecursiveWatcher

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

RecursiveWatcher is an instance of a recursive watcher. Create a new RecursiveWatcher via NewRecursiveWatcher.

func NewRecursiveWatcher

func NewRecursiveWatcher(rootDir string, opts ...Option) (*RecursiveWatcher, error)

NewRecursiveWatcher creates a new recursive watcher rooted at directory rootDir.

func (*RecursiveWatcher) Close

func (w *RecursiveWatcher) Close() error

Close shuts down the watcher, by removing all watches and closing the Events channel.

func (*RecursiveWatcher) Errors

func (w *RecursiveWatcher) Errors() <-chan error

func (*RecursiveWatcher) Events

func (w *RecursiveWatcher) Events() <-chan fsnotify.Event

type Watcher

type Watcher[T any] interface {
	Events() <-chan T
	Errors() <-chan error
	Close() error
}

Jump to

Keyboard shortcuts

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