Class: KafkaSyrup::Protocol::MetadataResponse::Topic
- Inherits:
-
Struct
- Object
- Struct
- KafkaSyrup::Protocol::MetadataResponse::Topic
- Defined in:
- lib/kafka_syrup/protocol/metadata_response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#name ⇒ Object
Returns the value of attribute name.
-
#partitions ⇒ Object
Returns the value of attribute partitions.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
58 59 60 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 58 def code @code end |
#name ⇒ Object
Returns the value of attribute name
58 59 60 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 58 def name @name end |
#partitions ⇒ Object
Returns the value of attribute partitions
58 59 60 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 58 def partitions @partitions end |
Class Method Details
.decode(io) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 73 def self.decode(io) new( E.read_int16(io), # Error Code E.read_string(io), # Name E.read_array(io, &Partition.method(:decode)) # Partitions ) end |
Instance Method Details
#add_partition(p_code, id, leader, replicas, isr) ⇒ Object
59 60 61 62 63 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 59 def add_partition(p_code, id, leader, replicas, isr) partition = Partition.new(p_code, id, leader, replicas, isr) partitions << partition partition end |
#encode ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 65 def encode [ E.write_int16(code), E.write_string(name), E.write_array(partitions) ].join end |