MCPcopy
hub / github.com/IBM/sarama / Partition

Method Partition

partitioner.go:267–276  ·  view source on GitHub ↗
(message *ProducerMessage, numPartitions int32)

Source from the content-addressed store, hash-verified

265}
266
267func (p *murmur2Partitioner) Partition(message *ProducerMessage, numPartitions int32) (int32, error) {
268 if message.Key == nil {
269 return p.random.Partition(message, numPartitions)
270 }
271 bytes, err := message.Key.Encode()
272 if err != nil {
273 return -1, err
274 }
275 return int32(murmur2(bytes)&0x7fffffff) % numPartitions, nil
276}
277
278func (p *murmur2Partitioner) RequiresConsistency() bool {
279 return true

Callers

nothing calls this directly

Calls 3

murmur2Function · 0.85
PartitionMethod · 0.65
EncodeMethod · 0.65

Tested by

no test coverage detected