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

Struct CRC32Balancer

balancer.go:256–259  ·  view source on GitHub ↗

CRC32Balancer is a Balancer that uses the CRC32 hash function to determine which partition to route messages to. This ensures that messages with the same key are routed to the same partition. This balancer is compatible with the built-in hash partitioners in librdkafka and the language bindings th

Source from the content-addressed store, hash-verified

254// best to leave the Consistent flag off. Otherwise, you run the risk of
255// creating a very hot partition.
256type CRC32Balancer struct {
257 Consistent bool
258 random randomBalancer
259}
260
261func (b CRC32Balancer) Balance(msg Message, partitions ...int) (partition int) {
262 // NOTE: the crc32 balancers in librdkafka don't differentiate between nil

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected