batch

package
v0.0.0-...-5c7ffcf Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	// must be reentrancy
	Consume([]interface{})
}

type KeyBatchProcessor

type KeyBatchProcessor interface {
	TryPut(string, interface{}) bool

	Run()
	Shutdown()

	KeyNum() int
	BufferNum() int

	AdjustBatchMaxSize(int)
	AdjustBatchMaxWait(duration int)
	// contains filtered or unexported methods
}

func NewBatchProcessorWithKey

func NewBatchProcessorWithKey(s int, c KeyConsumer, opts ...OptionFunc) KeyBatchProcessor

type KeyConsumer

type KeyConsumer interface {
	// must be reentrancy
	Consume(string, []interface{})
}

type OptionFunc

type OptionFunc func(*options)

func WithBatchThresholdStrategy

func WithBatchThresholdStrategy(n int) OptionFunc

func WithItemsWeightStrategy

func WithItemsWeightStrategy(calculator func(i interface{}) int, threshold int) OptionFunc

func WithMaxWaitStrategy

func WithMaxWaitStrategy(i time.Duration) OptionFunc

type Processor

type Processor interface {
	Put(interface{})
	TryPut(interface{}) bool

	Run()
	Shutdown()

	Num() int

	AdjustBatchMaxSize(int)
	AdjustBatchMaxWait(duration int)
	// contains filtered or unexported methods
}

func NewBatchProcessor

func NewBatchProcessor(s int, c Consumer, opts ...OptionFunc) Processor

Jump to

Keyboard shortcuts

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