batcher

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batcher

type Batcher[T any] struct {
	Buffer   int           `mapstructure:"batch_buffer"`
	Interval time.Duration `mapstructure:"batch_interval"`
}

batcher is a helper for cases when plugin needs to send events in batches it passes a batch of events to passed func when: - buffer is full - ticker ticks - input chanel is closed and readed to the end

batcher clears buffer after each call of flushFn()

func (*Batcher[T]) Run

func (b *Batcher[T]) Run(in <-chan T, flushFn func(buf []T))

Jump to

Keyboard shortcuts

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