watch

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 10 Imported by: 1 module, 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 watch contains the watch node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WatchConfig

type WatchConfig struct {
	// Filename is the file or directory to watch. A directory without
	// Recursive watches its immediate entries only.
	Filename string `json:"filename"`
	// Recursive walks subdirectories when Filename is a directory.
	Recursive bool `json:"recursive"`
	// Interval is the poll period in seconds (default 1). A polling
	// implementation is used so the node is cross-platform without an
	// fsnotify dependency.
	Interval float64 `json:"interval"`
}

WatchConfig holds configuration for the watch node — the Node-RED `watch` equivalent: a filesystem watcher emitting one message per changed path.

type WatchNode

type WatchNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

WatchNode polls the filesystem for changes and emits a message per created/modified/deleted path (Stopper lifecycle like other triggers).

func NewWatchNode

func NewWatchNode(node nodestore.NodeInterface, config *WatchConfig, host nodebase.NodeHost) *WatchNode

NewWatchNode creates a new watch node

func (*WatchNode) Execute

Execute resolves the watch path, takes the baseline snapshot and starts the polling goroutine.

func (*WatchNode) Stop

func (n *WatchNode) Stop() error

Stop halts the polling goroutine (idempotent).

func (*WatchNode) Validate

func (n *WatchNode) Validate() error

Validate checks the watch node configuration

Jump to

Keyboard shortcuts

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