forked from zendesk/ruby-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtxn_offset_commit_response.rb
47 lines (40 loc) · 1.03 KB
/
txn_offset_commit_response.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true
module Kafka
module Protocol
class TxnOffsetCommitResponse
class PartitionError
attr_reader :partition, :error_code
def initialize(partition:, error_code:)
@partition = partition
@error_code = error_code
end
end
class TopicPartitionsError
attr_reader :topic, :partitions
def initialize(topic:, partitions:)
@topic = topic
@partitions = partitions
end
end
attr_reader :errors
def initialize(errors:)
@errors = errors
end
def self.decode(decoder)
_throttle_time_ms = decoder.int32
errors = decoder.array do
TopicPartitionsError.new(
topic: decoder.string,
partitions: decoder.array do
PartitionError.new(
partition: decoder.int32,
error_code: decoder.int16
)
end
)
end
new(errors: errors)
end
end
end
end