batch

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 8 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 batch contains the batch node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchConfig

type BatchConfig struct {
	// Mode selects grouping: "count" batches every N messages,
	// "interval" flushes everything buffered every Interval seconds,
	// "concat" merges one complete parts sequence per configured topic
	Mode string `json:"mode"`
	// Count is the batch size for "count" mode
	Count int `json:"count"`
	// Overlap keeps the last N messages of a batch for the next batch
	// ("count" mode)
	Overlap int `json:"overlap"`
	// Interval is the window length in seconds for "interval" mode
	Interval float64 `json:"interval"`
	// AllowEmptySequence emits an empty sequence message when an
	// interval window closes with nothing buffered
	AllowEmptySequence bool `json:"allowEmptySequence"`
	// HonourParts flushes a count-mode batch early when an incoming
	// parts sequence completes (parts.index+1 == parts.count)
	HonourParts bool `json:"honourParts"`
	// Topics lists the concat-mode topics in output order; each entry
	// is {"topic": "..."} as serialized by Node-RED
	Topics []struct {
		Topic string `json:"topic"`
	} `json:"topics"`
}

BatchConfig holds configuration for the batch node — the Node-RED batch equivalent. Buffers messages and re-emits them as a parts sequence (count/interval) or concatenates topic sequences (concat).

type BatchNode

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

BatchNode re-emits buffered messages as a parts sequence. Buffered messages are dropped (nil return); completed batches go downstream asynchronously through the node's outgoing edges.

func NewBatchNode

func NewBatchNode(node nodestore.NodeInterface, config *BatchConfig, host nodebase.NodeHost) *BatchNode

NewBatchNode creates a new batch node

func (*BatchNode) Execute

Execute buffers the message and, when a batch completes, emits the sequence asynchronously — the triggering message itself is dropped.

func (*BatchNode) Validate

func (n *BatchNode) Validate() error

Validate rejects unsupported modes at deploy time

Jump to

Keyboard shortcuts

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