Current section
Files
Jump to
Current section
Files
lib/generated/elect_leaders.ex
defmodule Kayrock.ElectLeaders do
@api :elect_leaders
@moduledoc "Kayrock-generated module for the Kafka `#{@api}` API
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
(
@vmin 0
@vmax 2
)
defmodule V0.Request do
@vsn 0
@api :elect_leaders
@schema topic_partitions: {:array, topic: :string, partition_id: {:array, :int32}},
timeout_ms: :int32
@moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct topic_partitions: [], timeout_ms: nil, correlation_id: nil, client_id: nil
import Elixir.Kayrock.Serialize
@typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
topic_partitions: [%{topic: nil | binary(), partition_id: [nil | integer()]}],
timeout_ms: nil | integer(),
correlation_id: nil | integer(),
client_id: nil | binary()
}
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
0
end
@doc "Returns a function that can be used to deserialize the wire response from the\nbroker for this message type\n"
@spec response_deserializer :: (binary -> {V0.Response.t(), binary})
def response_deserializer do
&V0.Response.deserialize/1
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
topic_partitions: {:array, topic: :string, partition_id: {:array, :int32}},
timeout_ms: :int32
]
end
@doc "Serialize a message to binary data for transfer to a Kafka broker"
@spec serialize(t()) :: iodata
def serialize(%V0.Request{} = struct) do
[
<<api_key()::16, api_vsn()::16, struct.correlation_id::32>>,
case struct.client_id do
nil -> <<-1::16-signed>>
id -> <<byte_size(id)::16, id::binary>>
end,
[
case Map.fetch!(struct, :topic_partitions) do
nil ->
<<-1::32-signed>>
[] ->
<<0::32-signed>>
vals when is_list(vals) ->
[
<<length(vals)::32-signed>>,
for v <- vals do
[
serialize(:string, Map.fetch!(v, :topic)),
serialize_array(:int32, Map.fetch!(v, :partition_id))
]
end
]
end,
serialize(:int32, Map.fetch!(struct, :timeout_ms))
]
]
end
end
defimpl(Elixir.Kayrock.Request, for: V0.Request) do
def serialize(%V0.Request{} = struct) do
try do
V0.Request.serialize(struct)
rescue
e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__
end
end
def api_vsn(%V0.Request{}) do
V0.Request.api_vsn()
end
def response_deserializer(%V0.Request{}) do
V0.Request.response_deserializer()
end
end
defmodule V1.Request do
@vsn 1
@api :elect_leaders
@schema election_type: :int8,
topic_partitions: {:array, topic: :string, partition_id: {:array, :int32}},
timeout_ms: :int32
@moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct election_type: nil,
topic_partitions: [],
timeout_ms: nil,
correlation_id: nil,
client_id: nil
import Elixir.Kayrock.Serialize
@typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
election_type: nil | integer(),
topic_partitions: [%{topic: nil | binary(), partition_id: [nil | integer()]}],
timeout_ms: nil | integer(),
correlation_id: nil | integer(),
client_id: nil | binary()
}
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
1
end
@doc "Returns a function that can be used to deserialize the wire response from the\nbroker for this message type\n"
@spec response_deserializer :: (binary -> {V1.Response.t(), binary})
def response_deserializer do
&V1.Response.deserialize/1
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
election_type: :int8,
topic_partitions: {:array, topic: :string, partition_id: {:array, :int32}},
timeout_ms: :int32
]
end
@doc "Serialize a message to binary data for transfer to a Kafka broker"
@spec serialize(t()) :: iodata
def serialize(%V1.Request{} = struct) do
[
<<api_key()::16, api_vsn()::16, struct.correlation_id::32>>,
case struct.client_id do
nil -> <<-1::16-signed>>
id -> <<byte_size(id)::16, id::binary>>
end,
[
serialize(:int8, Map.fetch!(struct, :election_type)),
case Map.fetch!(struct, :topic_partitions) do
nil ->
<<-1::32-signed>>
[] ->
<<0::32-signed>>
vals when is_list(vals) ->
[
<<length(vals)::32-signed>>,
for v <- vals do
[
serialize(:string, Map.fetch!(v, :topic)),
serialize_array(:int32, Map.fetch!(v, :partition_id))
]
end
]
end,
serialize(:int32, Map.fetch!(struct, :timeout_ms))
]
]
end
end
defimpl(Elixir.Kayrock.Request, for: V1.Request) do
def serialize(%V1.Request{} = struct) do
try do
V1.Request.serialize(struct)
rescue
e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__
end
end
def api_vsn(%V1.Request{}) do
V1.Request.api_vsn()
end
def response_deserializer(%V1.Request{}) do
V1.Request.response_deserializer()
end
end
defmodule V2.Request do
@vsn 2
@api :elect_leaders
@schema election_type: :int8,
topic_partitions:
{:compact_array,
topic: :compact_string,
partition_id: {:compact_array, :int32},
tagged_fields: :tagged_fields},
timeout_ms: :int32,
tagged_fields: :tagged_fields
@moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct election_type: nil,
topic_partitions: [],
timeout_ms: nil,
tagged_fields: [],
correlation_id: nil,
client_id: nil
import Elixir.Kayrock.Serialize
@typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
election_type: nil | integer(),
topic_partitions:
nil
| [
%{
topic: nil | binary(),
partition_id: nil | [nil | integer()],
tagged_fields: [{non_neg_integer(), binary()}]
}
],
timeout_ms: nil | integer(),
tagged_fields: [{non_neg_integer(), binary()}],
correlation_id: nil | integer(),
client_id: nil | binary()
}
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
2
end
@doc "Returns a function that can be used to deserialize the wire response from the\nbroker for this message type\n"
@spec response_deserializer :: (binary -> {V2.Response.t(), binary})
def response_deserializer do
&V2.Response.deserialize/1
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
election_type: :int8,
topic_partitions:
{:compact_array,
topic: :compact_string,
partition_id: {:compact_array, :int32},
tagged_fields: :tagged_fields},
timeout_ms: :int32,
tagged_fields: :tagged_fields
]
end
@doc "Serialize a message to binary data for transfer to a Kafka broker"
@spec serialize(t()) :: iodata
def serialize(%V2.Request{} = struct) do
[
<<api_key()::16, api_vsn()::16, struct.correlation_id::32>>,
case struct.client_id do
nil -> <<-1::16-signed>>
id -> <<byte_size(id)::16, id::binary>>
end,
<<0>>,
[
serialize(:int8, Map.fetch!(struct, :election_type)),
case Map.fetch!(struct, :topic_partitions) do
nil ->
Kayrock.Serialize.encode_unsigned_varint(0)
[] ->
Kayrock.Serialize.encode_unsigned_varint(1)
vals when is_list(vals) ->
[
Kayrock.Serialize.encode_unsigned_varint(length(vals) + 1),
for v <- vals do
[
serialize(:compact_string, Map.fetch!(v, :topic)),
Kayrock.Serialize.serialize_compact_array(
:int32,
Map.fetch!(v, :partition_id)
),
serialize_tagged_fields(Map.get(v, :tagged_fields, []))
]
end
]
end,
serialize(:int32, Map.fetch!(struct, :timeout_ms)),
serialize_tagged_fields(Map.get(struct, :tagged_fields, []))
]
]
end
end
defimpl(Elixir.Kayrock.Request, for: V2.Request) do
def serialize(%V2.Request{} = struct) do
try do
V2.Request.serialize(struct)
rescue
e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__
end
end
def api_vsn(%V2.Request{}) do
V2.Request.api_vsn()
end
def response_deserializer(%V2.Request{}) do
V2.Request.response_deserializer()
end
end
(
@doc "Returns a request struct for this API with the given version"
@spec get_request_struct(integer) :: request_t
)
def get_request_struct(0) do
%V0.Request{}
end
def get_request_struct(1) do
%V1.Request{}
end
def get_request_struct(2) do
%V2.Request{}
end
defmodule V0.Response do
@vsn 0
@api :elect_leaders
@schema throttle_time_ms: :int32,
replica_election_results:
{:array,
topic: :string,
partition_result:
{:array,
partition_id: :int32, error_code: :int16, error_message: :nullable_string}}
@moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct throttle_time_ms: nil, replica_election_results: [], correlation_id: nil
@typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
throttle_time_ms: nil | integer(),
replica_election_results: [
%{
topic: nil | binary(),
partition_result: [
%{
partition_id: nil | integer(),
error_code: nil | integer(),
error_message: nil | binary()
}
]
}
],
correlation_id: integer()
}
import Elixir.Kayrock.Deserialize
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
0
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
throttle_time_ms: :int32,
replica_election_results:
{:array,
topic: :string,
partition_result:
{:array, partition_id: :int32, error_code: :int16, error_message: :nullable_string}}
]
end
@doc "Deserialize data for this version of this API\n"
@spec deserialize(binary) :: {t(), binary}
def deserialize(data) do
<<correlation_id::32-signed, rest::binary>> = data
deserialize_field(
:root,
:throttle_time_ms,
%__MODULE__{correlation_id: correlation_id},
rest
)
end
defp deserialize_field(:root, :throttle_time_ms, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(
:root,
:replica_election_results,
Map.put(acc, :throttle_time_ms, val),
rest
)
end
defp deserialize_field(:replica_election_results, :topic, acc, data) do
{val, rest} = deserialize(:string, data)
deserialize_field(
:replica_election_results,
:partition_result,
Map.put(acc, :topic, val),
rest
)
end
defp deserialize_field(:partition_result, :partition_id, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(:partition_result, :error_code, Map.put(acc, :partition_id, val), rest)
end
defp deserialize_field(:partition_result, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:partition_result, :error_message, Map.put(acc, :error_code, val), rest)
end
defp deserialize_field(:partition_result, :error_message, acc, data) do
{val, rest} = deserialize(:nullable_string, data)
deserialize_field(:partition_result, nil, Map.put(acc, :error_message, val), rest)
end
defp deserialize_field(:replica_election_results, :partition_result, acc, data) do
<<num_elements::32-signed, rest::binary>> = data
{vals, rest} =
if num_elements > 0 do
Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} ->
{val, r} = deserialize_field(:partition_result, :partition_id, %{}, d)
{[val | acc], r}
end)
else
{[], rest}
end
deserialize_field(
:replica_election_results,
nil,
Map.put(acc, :partition_result, Enum.reverse(vals)),
rest
)
end
defp deserialize_field(:root, :replica_election_results, acc, data) do
<<num_elements::32-signed, rest::binary>> = data
{vals, rest} =
if num_elements > 0 do
Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} ->
{val, r} = deserialize_field(:replica_election_results, :topic, %{}, d)
{[val | acc], r}
end)
else
{[], rest}
end
deserialize_field(
:root,
nil,
Map.put(acc, :replica_election_results, Enum.reverse(vals)),
rest
)
end
defp deserialize_field(_, nil, acc, rest) do
{acc, rest}
end
end
defmodule V1.Response do
@vsn 1
@api :elect_leaders
@schema throttle_time_ms: :int32,
error_code: :int16,
replica_election_results:
{:array,
topic: :string,
partition_result:
{:array,
partition_id: :int32, error_code: :int16, error_message: :nullable_string}}
@moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct throttle_time_ms: nil,
error_code: nil,
replica_election_results: [],
correlation_id: nil
@typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
throttle_time_ms: nil | integer(),
error_code: nil | integer(),
replica_election_results: [
%{
topic: nil | binary(),
partition_result: [
%{
partition_id: nil | integer(),
error_code: nil | integer(),
error_message: nil | binary()
}
]
}
],
correlation_id: integer()
}
import Elixir.Kayrock.Deserialize
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
1
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
throttle_time_ms: :int32,
error_code: :int16,
replica_election_results:
{:array,
topic: :string,
partition_result:
{:array, partition_id: :int32, error_code: :int16, error_message: :nullable_string}}
]
end
@doc "Deserialize data for this version of this API\n"
@spec deserialize(binary) :: {t(), binary}
def deserialize(data) do
<<correlation_id::32-signed, rest::binary>> = data
deserialize_field(
:root,
:throttle_time_ms,
%__MODULE__{correlation_id: correlation_id},
rest
)
end
defp deserialize_field(:root, :throttle_time_ms, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(:root, :error_code, Map.put(acc, :throttle_time_ms, val), rest)
end
defp deserialize_field(:root, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:root, :replica_election_results, Map.put(acc, :error_code, val), rest)
end
defp deserialize_field(:replica_election_results, :topic, acc, data) do
{val, rest} = deserialize(:string, data)
deserialize_field(
:replica_election_results,
:partition_result,
Map.put(acc, :topic, val),
rest
)
end
defp deserialize_field(:partition_result, :partition_id, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(:partition_result, :error_code, Map.put(acc, :partition_id, val), rest)
end
defp deserialize_field(:partition_result, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:partition_result, :error_message, Map.put(acc, :error_code, val), rest)
end
defp deserialize_field(:partition_result, :error_message, acc, data) do
{val, rest} = deserialize(:nullable_string, data)
deserialize_field(:partition_result, nil, Map.put(acc, :error_message, val), rest)
end
defp deserialize_field(:replica_election_results, :partition_result, acc, data) do
<<num_elements::32-signed, rest::binary>> = data
{vals, rest} =
if num_elements > 0 do
Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} ->
{val, r} = deserialize_field(:partition_result, :partition_id, %{}, d)
{[val | acc], r}
end)
else
{[], rest}
end
deserialize_field(
:replica_election_results,
nil,
Map.put(acc, :partition_result, Enum.reverse(vals)),
rest
)
end
defp deserialize_field(:root, :replica_election_results, acc, data) do
<<num_elements::32-signed, rest::binary>> = data
{vals, rest} =
if num_elements > 0 do
Enum.reduce(1..num_elements, {[], rest}, fn _ix, {acc, d} ->
{val, r} = deserialize_field(:replica_election_results, :topic, %{}, d)
{[val | acc], r}
end)
else
{[], rest}
end
deserialize_field(
:root,
nil,
Map.put(acc, :replica_election_results, Enum.reverse(vals)),
rest
)
end
defp deserialize_field(_, nil, acc, rest) do
{acc, rest}
end
end
defmodule V2.Response do
@vsn 2
@api :elect_leaders
@schema throttle_time_ms: :int32,
error_code: :int16,
replica_election_results:
{:compact_array,
topic: :compact_string,
partition_result:
{:compact_array,
partition_id: :int32,
error_code: :int16,
error_message: :compact_nullable_string,
tagged_fields: :tagged_fields},
tagged_fields: :tagged_fields},
tagged_fields: :tagged_fields
@moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API
messages
The schema of this API is
```
#{inspect(@schema, pretty: true)}
```
"
_ = " THIS CODE IS GENERATED BY KAYROCK"
defstruct throttle_time_ms: nil,
error_code: nil,
replica_election_results: [],
tagged_fields: [],
correlation_id: nil
@typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
throttle_time_ms: nil | integer(),
error_code: nil | integer(),
replica_election_results:
nil
| [
%{
topic: nil | binary(),
partition_result:
nil
| [
%{
partition_id: nil | integer(),
error_code: nil | integer(),
error_message: nil | binary(),
tagged_fields: [{non_neg_integer(), binary()}]
}
],
tagged_fields: [{non_neg_integer(), binary()}]
}
],
tagged_fields: [{non_neg_integer(), binary()}],
correlation_id: integer()
}
import Elixir.Kayrock.Deserialize
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:elect_leaders)
end
@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def api_vsn do
2
end
@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def schema do
[
throttle_time_ms: :int32,
error_code: :int16,
replica_election_results:
{:compact_array,
topic: :compact_string,
partition_result:
{:compact_array,
partition_id: :int32,
error_code: :int16,
error_message: :compact_nullable_string,
tagged_fields: :tagged_fields},
tagged_fields: :tagged_fields},
tagged_fields: :tagged_fields
]
end
@doc "Deserialize data for this version of this API\n"
@spec deserialize(binary) :: {t(), binary}
def deserialize(data) do
<<correlation_id::32-signed, rest::binary>> = data
{_tagged_fields, rest} = deserialize_tagged_fields(rest)
deserialize_field(
:root,
:throttle_time_ms,
%__MODULE__{correlation_id: correlation_id},
rest
)
end
defp deserialize_field(:root, :throttle_time_ms, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(:root, :error_code, Map.put(acc, :throttle_time_ms, val), rest)
end
defp deserialize_field(:root, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:root, :replica_election_results, Map.put(acc, :error_code, val), rest)
end
defp deserialize_field(:replica_election_results, :topic, acc, data) do
{val, rest} = deserialize(:compact_string, data)
deserialize_field(
:replica_election_results,
:partition_result,
Map.put(acc, :topic, val),
rest
)
end
defp deserialize_field(:partition_result, :partition_id, acc, data) do
{val, rest} = deserialize(:int32, data)
deserialize_field(:partition_result, :error_code, Map.put(acc, :partition_id, val), rest)
end
defp deserialize_field(:partition_result, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:partition_result, :error_message, Map.put(acc, :error_code, val), rest)
end
defp deserialize_field(:partition_result, :error_message, acc, data) do
{val, rest} = deserialize(:compact_nullable_string, data)
deserialize_field(
:partition_result,
:tagged_fields,
Map.put(acc, :error_message, val),
rest
)
end
defp deserialize_field(:partition_result, :tagged_fields, acc, data) do
{val, rest} = Kayrock.Deserialize.deserialize_tagged_fields(data)
deserialize_field(:partition_result, nil, Map.put(acc, :tagged_fields, val), rest)
end
defp deserialize_field(:replica_election_results, :partition_result, acc, data) do
{len_plus_one, rest} = Kayrock.Deserialize.decode_unsigned_varint(data)
{vals, rest} =
case len_plus_one do
0 ->
{nil, rest}
1 ->
{[], rest}
_ ->
Enum.reduce(1..(len_plus_one - 1), {[], rest}, fn _ix, {acc_inner, d} ->
{val, r} = deserialize_field(:partition_result, :partition_id, %{}, d)
{[val | acc_inner], r}
end)
end
final_vals =
if is_nil(vals) do
nil
else
Enum.reverse(vals)
end
deserialize_field(
:replica_election_results,
:tagged_fields,
Map.put(acc, :partition_result, final_vals),
rest
)
end
defp deserialize_field(:replica_election_results, :tagged_fields, acc, data) do
{val, rest} = Kayrock.Deserialize.deserialize_tagged_fields(data)
deserialize_field(:replica_election_results, nil, Map.put(acc, :tagged_fields, val), rest)
end
defp deserialize_field(:root, :replica_election_results, acc, data) do
{len_plus_one, rest} = Kayrock.Deserialize.decode_unsigned_varint(data)
{vals, rest} =
case len_plus_one do
0 ->
{nil, rest}
1 ->
{[], rest}
_ ->
Enum.reduce(1..(len_plus_one - 1), {[], rest}, fn _ix, {acc_inner, d} ->
{val, r} = deserialize_field(:replica_election_results, :topic, %{}, d)
{[val | acc_inner], r}
end)
end
final_vals =
if is_nil(vals) do
nil
else
Enum.reverse(vals)
end
deserialize_field(
:root,
:tagged_fields,
Map.put(acc, :replica_election_results, final_vals),
rest
)
end
defp deserialize_field(:root, :tagged_fields, acc, data) do
{val, rest} = Kayrock.Deserialize.deserialize_tagged_fields(data)
deserialize_field(:root, nil, Map.put(acc, :tagged_fields, val), rest)
end
defp deserialize_field(_, nil, acc, rest) do
{acc, rest}
end
end
(
@doc "Deserializes raw wire data for this API with the given version"
@spec deserialize(integer, binary) :: {response_t, binary}
)
def deserialize(0, data) do
V0.Response.deserialize(data)
end
def deserialize(1, data) do
V1.Response.deserialize(data)
end
def deserialize(2, data) do
V2.Response.deserialize(data)
end
(
@typedoc "Union type for all request structs for this API"
@type request_t ::
Kayrock.ElectLeaders.V2.Request.t()
| Kayrock.ElectLeaders.V1.Request.t()
| Kayrock.ElectLeaders.V0.Request.t()
)
(
@typedoc "Union type for all response structs for this API"
@type response_t ::
Kayrock.ElectLeaders.V2.Response.t()
| Kayrock.ElectLeaders.V1.Response.t()
| Kayrock.ElectLeaders.V0.Response.t()
)
(
@doc "Returns the minimum version of this API supported by Kayrock (#{@vmin})"
@spec min_vsn :: integer
def min_vsn do
0
end
)
(
@doc "Returns the maximum version of this API supported by Kayrock (#{@vmax})"
@spec max_vsn :: integer
def max_vsn do
2
end
)
end