Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batcher ¶
type Batcher struct { MaxSize int BatchTime time.Duration // contains filtered or unexported fields }
func New ¶
New returns a simple Batcher that can be used to buffer & batch values as simple as this:
b := batcher.New(1024, 5*time.Second) for { select { case <- b.Await(): b.Reset() flush(messages) messages = nil case msg <- kafka.Messages(): b.Increment() messages = append(messages, msg) } }
Click to show internal directories.
Click to hide internal directories.