private static ElectionType electionType(byte electionType) {
        try {
            return ElectionType.valueOf(electionType);
        } catch (IllegalArgumentException e) {
            throw new InvalidRequestException("Unknown election type " + (int) electionType);
        }
    }
Generates the appropriate records to handle a list of directories being reported offline.

If the reported directories include directories that were previously online, this includes
a BrokerRegistrationChangeRecord and any number of PartitionChangeRecord to update
leadership and ISR for partitions in those directories that were previously online.

@param brokerId    The broker id.
@param brokerEpoch The broker epoch.
@param offlineDirs The list of directories that are offline.
@param records     The record list to append to.
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java