View Source KlifeProtocol.Messages.ElectLeaders (Klife Protocol v0.7.0)

Kafka protocol ElectLeaders message

Request versions summary:

  • Version 1 implements multiple leader election types, as described by KIP-460.
  • Version 2 is the first flexible version.

Response versions summary:

  • Version 1 adds a top-level error code.
  • Version 2 is the first flexible version.

Link to this section Summary

Functions

Returns the message api key number.

Receive a binary in the kafka wire format and deserialize it into a map.

Returns the current max supported version of this message.

Returns the current min supported version of this message.

Receives a map and serialize it to kafka wire format of the given version.

Link to this section Functions

Returns the message api key number.

Link to this function

deserialize_response(data, version, with_header? \\ true)

View Source

Receive a binary in the kafka wire format and deserialize it into a map.

Response content fields:

  • throttle_time_ms: The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. (int32 | versions 0+)

  • error_code: The top level response error code. (int16 | versions 1+)

  • replica_election_results: The election results, or an empty array if the requester did not have permission and the request asks for all partitions. ([]ReplicaElectionResult | versions 0+)

    • topic: The topic name (string | versions 0+)

    • partition_result: The results for each partition ([]PartitionResult | versions 0+)

      • partition_id: The partition id (int32 | versions 0+)

      • error_code: The result error, or zero if there was no error. (int16 | versions 0+)

      • error_message: The result message, or null if there was no error. (string | versions 0+)

Returns the current max supported version of this message.

Returns the current min supported version of this message.

Link to this function

serialize_request(map, version)

View Source

Receives a map and serialize it to kafka wire format of the given version.

Input content fields:

  • election_type: Type of elections to conduct for the partition. A value of '0' elects the preferred replica. A value of '1' elects the first live replica if there are no in-sync replica. (int8 | versions 1+)

  • topic_partitions: The topic partitions to elect leaders. ([]TopicPartitions | versions 0+)

    • topic: The name of a topic. (string | versions 0+)

    • partitions: The partitions of this topic whose leader should be elected. ([]int32 | versions 0+)

  • timeout_ms: The time in ms to wait for the election to complete. (int32 | versions 0+)