pub fn role_partition(
role: &Role,
partitions: i32,
) -> Result<i32, CoordinationError>Expand description
The partition that holds every record of role.
The rule is Kafka’s own key partitioning, which
krabka_client_producer::partition_for_key implements: murmur2 of the
role name in UTF-8, masked with Utils.toPositive, then the remainder of
partitions. krabka-streams-java and krabka-streams-go write the same
topic, so they implement the same rule. A change here needs the same change
in the two ports.
Both producers of a role call this and pin the partition on the record. The key of a registration and the key of a lease differ, so a partitioner that hashes the key would split one role across two partitions and destroy the total order the succession rules rank on.
§Errors
Returns CoordinationError::InvalidConfig when partitions is not
positive.