fspoll

package
v0.0.0-...-44e12ef Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package fspoll implements a primitive polling-based filesystem watcher.

Index

Constants

View Source
const (
	DefaultInterval = 1 * time.Second
	SleepAfter      = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {

	// event channels
	Change chan bool
	Error  chan error
	// contains filtered or unexported fields
}

func Watch

func Watch(dir string, excludeGlobs []string, interval, sleepInterval time.Duration) (w *Watcher, err error)

Watch polls the given directory and subdirectories and files inside it, excluding the given globs, for changes with the given interval.

When there was no change for the given interval in 5 minutes, interval changes to sleepInterval (interval * 5 by default). It's back to normal interval if a change is detected. If sleepInterval is negative, don't sleep.

It returns a Watcher or an error.

func (*Watcher) Close

func (w *Watcher) Close()

Close stops the watcher.

Jump to

Keyboard shortcuts

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