Package com.linkedin.venice.unit.kafka
Class SimplePartitioner
java.lang.Object
com.linkedin.venice.partitioner.VenicePartitioner
com.linkedin.venice.unit.kafka.SimplePartitioner
This
VenicePartitioner
implementation takes the first byte of the key,
and computes the partition as such:
firstByte % numPartitions
It is meant to be used in tests where we want to control the partition that a
key belongs to, but without needing to work out a proper input that yields the
desired partition when hashed by the
DefaultVenicePartitioner
.-
Field Summary
Fields inherited from class com.linkedin.venice.partitioner.VenicePartitioner
props
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getPartitionId
(byte[] keyBytes, int numPartitions) A function that returns the partitionId based on the key and partition count.int
getPartitionId
(ByteBuffer keyByteBuffer, int numPartitions) Methods inherited from class com.linkedin.venice.partitioner.VenicePartitioner
checkSchema, getPartitionId
-
Constructor Details
-
SimplePartitioner
public SimplePartitioner() -
SimplePartitioner
-
SimplePartitioner
-
-
Method Details
-
getPartitionId
public int getPartitionId(byte[] keyBytes, int numPartitions) Description copied from class:VenicePartitioner
A function that returns the partitionId based on the key and partition count.- Specified by:
getPartitionId
in classVenicePartitioner
- Parameters:
keyBytes
- - A key that will be mapped into a partitionnumPartitions
- - The number of total partitions available in Kafka/storage- Returns:
-
getPartitionId
- Specified by:
getPartitionId
in classVenicePartitioner
-