Class: Kafka::FFI::TopicMetadata
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Kafka::FFI::TopicMetadata
- Defined in:
- lib/kafka/ffi/topic_metadata.rb
Instance Method Summary collapse
-
#error ⇒ nil, Kafka::ResponseError
Returns any Broker reported errors.
-
#partitions ⇒ Array<PartitionMetadata>
Returns the set of PartitionMetadata for the Topic.
-
#topic ⇒ String
(also: #name)
Returns the name of the topic.
Instance Method Details
#error ⇒ nil, Kafka::ResponseError
Returns any Broker reported errors.
24 25 26 27 28 |
# File 'lib/kafka/ffi/topic_metadata.rb', line 24 def error if self[:err] != :ok return ::Kafka::ResponseError.new(self[:err]) end end |
#partitions ⇒ Array<PartitionMetadata>
Returns the set of PartitionMetadata for the Topic
34 35 36 37 38 39 40 |
# File 'lib/kafka/ffi/topic_metadata.rb', line 34 def partitions ptr = self[:partitions] self[:partition_cnt].times.map do |i| PartitionMetadata.new(ptr + (i * PartitionMetadata.size)) end end |
#topic ⇒ String Also known as: name
Returns the name of the topic
15 16 17 |
# File 'lib/kafka/ffi/topic_metadata.rb', line 15 def topic self[:topic] end |