Packages

An Elixir implementation of the Kafka protocol. It enables communication with Kafka brokers using standard Elixir data structures without the need for manual serialization.

Current section

Files

Jump to
klife_protocol lib klife_protocol generated messages metadata.ex
Raw

lib/klife_protocol/generated/messages/metadata.ex

# DO NOT EDIT THIS FILE MANUALLY
# This module is automatically generated by running mix task generate_file
# every change must be done inside the mix task directly
defmodule KlifeProtocol.Messages.Metadata do
@moduledoc """
Kafka protocol Metadata message
Request versions summary:
Response versions summary:
- Version 1 adds fields for the rack of each broker, the controller id, and whether or not the topic is internal.
- Version 2 adds the cluster ID field.
- Version 3 adds the throttle time.
- Version 4 is the same as version 3.
- Version 5 adds a per-partition offline_replicas field. This field specifies
the list of replicas that are offline.
- Starting in version 6, on quota violation, brokers send out responses before throttling.
- Version 7 adds the leader epoch to the partition metadata.
- Starting in version 8, brokers can send authorized operations for topic and cluster.
- Version 9 is the first flexible version.
- Version 10 adds topicId.
- Version 11 deprecates ClusterAuthorizedOperations. This is now exposed
by the DescribeCluster API (KIP-700).
Version 12 supports topicId.
Version 13 supports top-level error code in the response.
"""
alias KlifeProtocol.Deserializer
alias KlifeProtocol.Serializer
alias KlifeProtocol.Header
@api_key 3
@min_flexible_version_req 9
@min_flexible_version_res 9
@doc """
Receives a map and serialize it to kafka wire format of the given version.
Input content fields:
- topics: The topics to fetch metadata for. ([]MetadataRequestTopic | versions 0+)
- topic_id: The topic id. (uuid | versions 10+)
- name: The topic name. (string | versions 0+)
- allow_auto_topic_creation: If this is true, the broker may auto-create topics that we requested which do not already exist, if it is configured to do so. (bool | versions 4+)
- include_cluster_authorized_operations: Whether to include cluster authorized operations. (bool | versions 8-10)
- include_topic_authorized_operations: Whether to include topic authorized operations. (bool | versions 8+)
"""
def serialize_request(%{headers: headers, content: content}, version) do
headers
|> Map.put(:request_api_key, @api_key)
|> Map.put(:request_api_version, version)
|> Header.serialize_request(req_header_version(version))
|> then(&Serializer.execute(content, request_schema(version), &1))
end
@doc """
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 3+)
- brokers: A list of brokers present in the cluster. ([]MetadataResponseBroker | versions 0+)
- node_id: The broker ID. (int32 | versions 0+)
- host: The broker hostname. (string | versions 0+)
- port: The broker port. (int32 | versions 0+)
- rack: The rack of the broker, or null if it has not been assigned to a rack. (string | versions 1+)
- cluster_id: The cluster ID that responding broker belongs to. (string | versions 2+)
- controller_id: The ID of the controller broker. (int32 | versions 1+)
- topics: Each topic in the response. ([]MetadataResponseTopic | versions 0+)
- error_code: The topic error, or 0 if there was no error. (int16 | versions 0+)
- name: The topic name. Null for non-existing topics queried by ID. This is never null when ErrorCode is zero. One of Name and TopicId is always populated. (string | versions 0+)
- topic_id: The topic id. Zero for non-existing topics queried by name. This is never zero when ErrorCode is zero. One of Name and TopicId is always populated. (uuid | versions 10+)
- is_internal: True if the topic is internal. (bool | versions 1+)
- partitions: Each partition in the topic. ([]MetadataResponsePartition | versions 0+)
- error_code: The partition error, or 0 if there was no error. (int16 | versions 0+)
- partition_index: The partition index. (int32 | versions 0+)
- leader_id: The ID of the leader broker. (int32 | versions 0+)
- leader_epoch: The leader epoch of this partition. (int32 | versions 7+)
- replica_nodes: The set of all nodes that host this partition. ([]int32 | versions 0+)
- isr_nodes: The set of nodes that are in sync with the leader for this partition. ([]int32 | versions 0+)
- offline_replicas: The set of offline replicas of this partition. ([]int32 | versions 5+)
- topic_authorized_operations: 32-bit bitfield to represent authorized operations for this topic. (int32 | versions 8+)
- cluster_authorized_operations: 32-bit bitfield to represent authorized operations for this cluster. (int32 | versions 8-10)
- error_code: The top-level error code, or 0 if there was no error. (int16 | versions 13+)
"""
def deserialize_response(data, version, with_header? \\ true)
def deserialize_response(data, version, true) do
{:ok, {headers, rest_data}} = Header.deserialize_response(data, res_header_version(version))
case Deserializer.execute(rest_data, response_schema(version)) do
{:ok, {content, <<>>}} ->
{:ok, %{headers: headers, content: content}}
{:error, _reason} = err ->
err
end
end
def deserialize_response(data, version, false) do
case Deserializer.execute(data, response_schema(version)) do
{:ok, {content, <<>>}} ->
{:ok, %{content: content}}
{:error, _reason} = err ->
err
end
end
@doc """
Returns the message api key number.
"""
def api_key(), do: @api_key
@doc """
Returns the current max supported version of this message.
"""
def max_supported_version(), do: 13
@doc """
Returns the current min supported version of this message.
"""
def min_supported_version(), do: 0
defp req_header_version(msg_version),
do: if(msg_version >= @min_flexible_version_req, do: 2, else: 1)
defp res_header_version(msg_version),
do: if(msg_version >= @min_flexible_version_res, do: 1, else: 0)
def request_schema(0),
do: [topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: false}}]
def request_schema(1),
do: [topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}}]
def request_schema(2),
do: [topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}}]
def request_schema(3),
do: [topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}}]
def request_schema(4),
do: [
topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}}
]
def request_schema(5),
do: [
topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}}
]
def request_schema(6),
do: [
topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}}
]
def request_schema(7),
do: [
topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}}
]
def request_schema(8),
do: [
topics: {{:array, [name: {:string, %{is_nullable?: false}}]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_cluster_authorized_operations: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}}
]
def request_schema(9),
do: [
topics:
{{:compact_array,
[name: {:compact_string, %{is_nullable?: false}}, tag_buffer: {:tag_buffer, []}]},
%{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_cluster_authorized_operations: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, []}
]
def request_schema(10),
do: [
topics:
{{:compact_array,
[
topic_id: {:uuid, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, []}
]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_cluster_authorized_operations: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, []}
]
def request_schema(11),
do: [
topics:
{{:compact_array,
[
topic_id: {:uuid, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, []}
]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, []}
]
def request_schema(12),
do: [
topics:
{{:compact_array,
[
topic_id: {:uuid, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, []}
]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, []}
]
def request_schema(13),
do: [
topics:
{{:compact_array,
[
topic_id: {:uuid, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, []}
]}, %{is_nullable?: true}},
allow_auto_topic_creation: {:boolean, %{is_nullable?: false}},
include_topic_authorized_operations: {:boolean, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, []}
]
def request_schema(unkown_version),
do: raise("Unknown version #{unkown_version} for message Metadata")
def response_schema(0),
do: [
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}}
]}, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(1),
do: [
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(2),
do: [
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(3),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(4),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(5),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(6),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(7),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]}, %{is_nullable?: false}}
]
def response_schema(8),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:string, %{is_nullable?: true}}
]}, %{is_nullable?: false}},
cluster_id: {:string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:array, :int32}, %{is_nullable?: false}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}}
]}, %{is_nullable?: false}},
cluster_authorized_operations: {:int32, %{is_nullable?: false}}
]
def response_schema(9),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:compact_array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:compact_string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_id: {:compact_string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:compact_array, :int32}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]
def response_schema(10),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:compact_array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:compact_string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_id: {:compact_string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: false}},
topic_id: {:uuid, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:compact_array, :int32}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]
def response_schema(11),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:compact_array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:compact_string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_id: {:compact_string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: false}},
topic_id: {:uuid, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:compact_array, :int32}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]
def response_schema(12),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:compact_array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:compact_string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_id: {:compact_string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
topic_id: {:uuid, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:compact_array, :int32}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]
def response_schema(13),
do: [
throttle_time_ms: {:int32, %{is_nullable?: false}},
brokers:
{{:compact_array,
[
node_id: {:int32, %{is_nullable?: false}},
host: {:compact_string, %{is_nullable?: false}},
port: {:int32, %{is_nullable?: false}},
rack: {:compact_string, %{is_nullable?: true}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
cluster_id: {:compact_string, %{is_nullable?: true}},
controller_id: {:int32, %{is_nullable?: false}},
topics:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
name: {:compact_string, %{is_nullable?: true}},
topic_id: {:uuid, %{is_nullable?: false}},
is_internal: {:boolean, %{is_nullable?: false}},
partitions:
{{:compact_array,
[
error_code: {:int16, %{is_nullable?: false}},
partition_index: {:int32, %{is_nullable?: false}},
leader_id: {:int32, %{is_nullable?: false}},
leader_epoch: {:int32, %{is_nullable?: false}},
replica_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
isr_nodes: {{:compact_array, :int32}, %{is_nullable?: false}},
offline_replicas: {{:compact_array, :int32}, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
topic_authorized_operations: {:int32, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]}, %{is_nullable?: false}},
error_code: {:int16, %{is_nullable?: false}},
tag_buffer: {:tag_buffer, %{}}
]
def response_schema(unkown_version),
do: raise("Unknown version #{unkown_version} for message Metadata")
end