chunks

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 5 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.

README

Chunks

The Chunks transform component splits incoming messages into smaller chunks based on a maximum size or idle time.


Class Definition

class Chunk extends Transform {
  fixed sourceName = "chunks"
  maxChunkSize: UInt32
  maxIdleTime: Duration
}

Attributes

Attribute Type Description Default Value
maxChunkSize UInt32 The maximum number of messages to include in each chunk. Required
maxIdleTime Duration The maximum idle time before creating a chunk with fewer than maxChunkSize. Required

I/O Types

  • Input Type: any
  • Output Type: chan any

Pkl Configuration Example

Basic Chunks Transform
new Transforms.Chunk {
  name = "example-chunks"
  maxChunkSize = 50
  maxIdleTime = 1.s
}

Description

The Chunks transform component breaks down a continuous stream of messages into smaller, manageable chunks. Chunks are created either when the maximum number of messages (maxChunkSize) is reached or when the stream remains idle for a specified duration (maxIdleTime).

Use Cases
  1. Stream Segmentation
    • Split a continuous data stream into smaller, manageable parts for downstream processing.
  2. Rate Control
    • Use maxIdleTime to ensure timely chunk delivery even when the stream has low activity.

Notes

  • Configure both maxChunkSize and maxIdleTime to balance performance and latency.
  • The choice of maxChunkSize and maxIdleTime should align with the requirements of downstream components.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	// contains filtered or unexported fields
}

func (*Chunk) Init

func (c *Chunk) Init(cfg transform.Transform) error

func (*Chunk) Transform

func (c *Chunk) Transform(val any) any

Jump to

Keyboard shortcuts

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