// Part of KIP-595 to replace Kafka's dependence on Zookeeper with a
// Kafka-only raft protocol,
// VoteRequest is used by voters to hold a leader election.
//
// Since this is relatively Kafka internal, most fields are left undocumented.
VoteRequest => key 52, max version 0, flexible v0+, admin
  ClusterID: nullable-string
  Topics: [=>]
    Topic: string
    Partitions: [=>]
      Partition: int32
      // The bumped epoch of the candidate sending the request.
      CandidateEpoch: int32
      // The ID of the voter sending the request.
      CandidateID: int32
      // The epoch of the last record written to the metadata log.
      LastOffsetEpoch: int32
      // The offset of the last record written to the metadata log.
      LastOffset: int64

VoteResponse =>
  ErrorCode: int16
  Topics: [=>]
    Topic: string
    Partitions: [=>]
      Partition: int32
      ErrorCode: int16
      // The ID of the current leader, or -1 if the leader is unknown.
      LeaderID: int32
      // The latest known leader epoch.
      LeaderEpoch: int32
      // Whether the vote was granted.
      VoteGranted: bool
