watchdriver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package watchdriver runs the native file watchers of the backends on one goroutine each: the goroutine owns the system's handles, adds and removes targets between waits, and reports what the system tells it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Add(platform.FileWatchTarget) error
	Remove(id uint64)
	Wait() ([]platform.FileWatchNotice, error)
	Wake()
	Close()
}

Driver is a backend's watcher. Every method but Wake runs on the goroutine of its Watch. Wait blocks until the system reports changes or Wake is called; an error it returns ends the watch.

type Watch

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

Watch is a platform.FileWatch running a Driver.

func New

func New(d Driver, notify func(platform.FileWatchNotice)) *Watch

New starts the goroutine of d, which calls notify with what d reports.

func (*Watch) Add

func (w *Watch) Add(t platform.FileWatchTarget) error

Add enrolls t and returns once the driver has.

func (*Watch) Close

func (w *Watch) Close()

Close stops the goroutine and waits until the driver has closed.

func (*Watch) Remove

func (w *Watch) Remove(id uint64)

Jump to

Keyboard shortcuts

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