Skip to content

Commit

Permalink
Regenerate code
Browse files Browse the repository at this point in the history
  • Loading branch information
Argonus committed Jan 19, 2024
1 parent ea5084b commit f16d63b
Show file tree
Hide file tree
Showing 38 changed files with 6,054 additions and 5,979 deletions.
100 changes: 55 additions & 45 deletions lib/generated/add_offsets_to_txn.ex
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
defmodule(Kayrock.AddOffsetsToTxn) do
defmodule Kayrock.AddOffsetsToTxn do
@api :add_offsets_to_txn
@moduledoc "Kayrock-generated module for the Kafka `#{@api}` API\n"
@moduledoc "Kayrock-generated module for the Kafka `#{@api}` API
"
_ = " THIS CODE IS GENERATED BY KAYROCK"

(
@vmin 0
@vmax 0
)

defmodule(V0.Request) do
defmodule V0.Request do
@vsn 0
@api :add_offsets_to_txn
@schema transactional_id: :string,
producer_id: :int64,
producer_epoch: :int16,
group_id: :string
@moduledoc "Kayrock-generated request struct for Kafka `#{@api}` v#{@vsn} API\nmessages\n\nThe schema of this API is\n```\n#{
inspect(@schema, pretty: true)
}\n```\n"
@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(
transactional_id: nil,
producer_id: nil,
producer_epoch: nil,
group_id: nil,
correlation_id: nil,
client_id: nil
)

import(Elixir.Kayrock.Serialize)
@typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn}\n"
defstruct transactional_id: nil,
producer_id: nil,
producer_epoch: nil,
group_id: nil,
correlation_id: nil,
client_id: nil

import Elixir.Kayrock.Serialize
@typedoc "Request struct for the Kafka `#{@api}` API v#{@vsn}
"
@type t :: %__MODULE__{
transactional_id: nil | binary(),
producer_id: nil | integer(),
Expand All @@ -41,31 +46,31 @@ defmodule(Kayrock.AddOffsetsToTxn) do
}
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def(api_key) do
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:add_offsets_to_txn)
end

@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def(api_vsn) do
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
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
def schema do
[transactional_id: :string, producer_id: :int64, producer_epoch: :int16, group_id: :string]
end

@doc "Serialize a message to binary data for transfer to a Kafka broker"
@spec serialize(t()) :: iodata
def(serialize(%V0.Request{} = struct)) do
def serialize(%V0.Request{} = struct) do
[
<<api_key()::16, api_vsn()::16, struct.correlation_id::32,
byte_size(struct.client_id)::16, struct.client_id::binary>>,
Expand All @@ -80,20 +85,19 @@ defmodule(Kayrock.AddOffsetsToTxn) do
end

defimpl(Elixir.Kayrock.Request, for: V0.Request) do
def(serialize(%V0.Request{} = struct)) do
def serialize(%V0.Request{} = struct) do
try do
V0.Request.serialize(struct)
rescue
e ->
reraise(Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__)
e -> reraise Kayrock.InvalidRequestError, {e, struct}, __STACKTRACE__
end
end

def(api_vsn(%V0.Request{})) do
def api_vsn(%V0.Request{}) do
V0.Request.api_vsn()
end

def(response_deserializer(%V0.Request{})) do
def response_deserializer(%V0.Request{}) do
V0.Request.response_deserializer()
end
end
Expand All @@ -103,47 +107,53 @@ defmodule(Kayrock.AddOffsetsToTxn) do
@spec get_request_struct(integer) :: request_t
)

def(get_request_struct(0)) do
def get_request_struct(0) do
%V0.Request{}
end

defmodule(V0.Response) do
defmodule V0.Response do
@vsn 0
@api :add_offsets_to_txn
@schema throttle_time_ms: :int32, error_code: :int16
@moduledoc "Kayrock-generated response struct for Kafka `#{@api}` v#{@vsn} API\nmessages\n\nThe schema of this API is\n```\n#{
inspect(@schema, pretty: true)
}\n```\n"
@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, correlation_id: nil)
@typedoc "Response struct for the Kafka `#{@api}` API v#{@vsn}\n"
defstruct throttle_time_ms: nil, error_code: nil, 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(),
correlation_id: integer()
}
import(Elixir.Kayrock.Deserialize)
import Elixir.Kayrock.Deserialize
@doc "Returns the Kafka API key for this API"
@spec api_key :: integer
def(api_key) do
def api_key do
Kayrock.KafkaSchemaMetadata.api_key(:add_offsets_to_txn)
end

@doc "Returns the API version (#{@vsn}) implemented by this module"
@spec api_vsn :: integer
def(api_vsn) do
def api_vsn do
0
end

@doc "Returns the schema of this message\n\nSee [above](#).\n"
@spec schema :: term
def(schema) do
def schema do
[throttle_time_ms: :int32, error_code: :int16]
end

@doc "Deserialize data for this version of this API\n"
@spec deserialize(binary) :: {t(), binary}
def(deserialize(data)) do
def deserialize(data) do
<<correlation_id::32-signed, rest::binary>> = data

deserialize_field(
Expand All @@ -154,17 +164,17 @@ defmodule(Kayrock.AddOffsetsToTxn) do
)
end

defp(deserialize_field(:root, :throttle_time_ms, acc, data)) do
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
defp deserialize_field(:root, :error_code, acc, data) do
{val, rest} = deserialize(:int16, data)
deserialize_field(:root, nil, Map.put(acc, :error_code, val), rest)
end

defp(deserialize_field(_, nil, acc, rest)) do
defp deserialize_field(_, nil, acc, rest) do
{acc, rest}
end
end
Expand All @@ -174,7 +184,7 @@ defmodule(Kayrock.AddOffsetsToTxn) do
@spec deserialize(integer, binary) :: {response_t, binary}
)

def(deserialize(0, data)) do
def deserialize(0, data) do
V0.Response.deserialize(data)
end

Expand All @@ -191,15 +201,15 @@ defmodule(Kayrock.AddOffsetsToTxn) do
(
@doc "Returns the minimum version of this API supported by Kayrock (#{@vmin})"
@spec min_vsn :: integer
def(min_vsn) do
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
def max_vsn do
0
end
)
Expand Down
Loading

0 comments on commit f16d63b

Please sign in to comment.