Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContextBatchNumKey = "batch_num" ContextBatchSizeKey = "batch_size" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batcher ¶
type Batcher struct {
// contains filtered or unexported fields
}
func NewBatcher ¶
NewBatcher creates a new Batcher with the given config.
func (*Batcher) Empty ¶ added in v1.1.0
Empty returns whether or not the are more items left in the batcher's queue.
type Config ¶
type Config struct {
// The frequency at which batches should be executed.
Interval time.Duration
// The maximum size of the queue of items.
Size int
// An optional callback to be executed before processing a batch.
// This is where expensive operations should usually be performed
// in order to make the batching efficient.
PreRunCb BatchCb
// An optional callback to be executed after processing a batch.
PostRunCb BatchCb
}
Click to show internal directories.
Click to hide internal directories.