MCPcopy
hub / github.com/segmentio/kafka-go / RoundRobin

Struct RoundRobin

balancer.go:41–48  ·  view source on GitHub ↗

RoundRobin is an Balancer implementation that equally distributes messages across all available partitions. It can take an optional chunk size to send ChunkSize messages to the same partition before moving to the next partition. This can be used to improve batch sizes.

Source from the content-addressed store, hash-verified

39// ChunkSize messages to the same partition before moving to the next partition.
40// This can be used to improve batch sizes.
41type RoundRobin struct {
42 ChunkSize int
43 // Use a 32 bits integer so RoundRobin values don't need to be aligned to
44 // apply increments.
45 counter uint32
46
47 mutex sync.Mutex
48}
49
50// Balance satisfies the Balancer interface.
51func (rr *RoundRobin) Balance(msg Message, partitions ...int) int {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected