Documentation
¶
Overview ¶
Package tail contains the tail node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TailConfig ¶
type TailConfig struct {
// Filename is the file to follow.
Filename string `json:"filename"`
// Filetype selects the emit mode: "text" (default — one message
// per appended line, Node-RED semantics) or "binary" (one []byte
// message per appended chunk).
Filetype string `json:"filetype"`
// Split is the record separator for text mode (default "\n";
// escape sequences like \r\n allowed).
Split string `json:"split"`
// Interval is the poll period in seconds (default 1).
Interval float64 `json:"interval"`
// FromStart reads the existing file content first instead of
// starting at the end (Node-RED `tail -f` starts at EOF).
FromStart bool `json:"fromStart"`
}
TailConfig holds configuration for the tail node — the Node-RED `tail` equivalent: it follows a growing file and emits newly appended content.
type TailNode ¶
TailNode follows a file's appended content via polling and emits each new line (or binary chunk) downstream. Polling keeps the node cross-platform without an fsnotify dependency.
func NewTailNode ¶
func NewTailNode(node nodestore.NodeInterface, config *TailConfig, host nodebase.NodeHost) *TailNode
NewTailNode creates a new tail node
func (*TailNode) Execute ¶
func (n *TailNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute resolves the file, opens it and starts the polling goroutine from the end (or the start with FromStart).