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 ¶
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 ¶
func (n *WatchNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute resolves the watch path, takes the baseline snapshot and starts the polling goroutine.