Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultBatchSize is the default batch size. DefaultBatchSize = 1000 // DefaultBatchInterval is the default batch interval. DefaultBatchInterval = 1 * time.Second // DefaultConcurrency is the default concurrency. DefaultConcurrency = 3 )
Variables ¶
View Source
var ErrTimeout = fmt.Errorf("timeout waiting for batches to complete")
Functions ¶
func NoOpProcessor ¶
Types ¶
type AtomicCounter ¶
type AtomicCounter struct {
// contains filtered or unexported fields
}
func NewAtomicCounter ¶
func NewAtomicCounter() *AtomicCounter
func (*AtomicCounter) Add ¶
func (c *AtomicCounter) Add(num int64)
func (*AtomicCounter) Read ¶
func (c *AtomicCounter) Read() int64
func (*AtomicCounter) Reset ¶
func (c *AtomicCounter) Reset()
type Batcher ¶
type Batcher[T any] struct { // contains filtered or unexported fields }
type Option ¶
func WithBatchInterval ¶
WithBatchInterval sets the batch interval.
func WithBatchSize ¶
WithBatchSize sets the batch size.
func WithProcessor ¶
WithProcessor sets the processor function to be called for each batch.
Click to show internal directories.
Click to hide internal directories.