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" batches everything arriving within a time window,
// "concat" concatenates a parts sequence into one message
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"`
// HonourParts keeps separate buffers per parts.id in count mode
HonourParts bool `json:"honourParts"`
}
BatchConfig holds configuration for the batch node — the Node-RED batch equivalent. Groups incoming messages into batches.
type BatchNode ¶
BatchNode groups incoming messages into batches. It drops (returns nil) buffered messages; completed batches go downstream as a single message whose Data is an array of the batched payloads.
func NewBatchNode ¶
func NewBatchNode(node nodestore.NodeInterface, config *BatchConfig, host nodebase.NodeHost) *BatchNode
NewBatchNode creates a new batch node
func (*BatchNode) Execute ¶
func (n *BatchNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute buffers and emits a batch message when a batch completes.