Class: Kafka::FFI::PartitionMetadata
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Kafka::FFI::PartitionMetadata
- Defined in:
- lib/kafka/ffi/partition_metadata.rb
Instance Method Summary collapse
-
#error ⇒ nil, Kafka::ResponseError
Returns the error for the Partition as reported by the Broker.
-
#id ⇒ Integer
Returns the Partition's ID.
-
#in_sync_replicas ⇒ Array<Integer>
Returns the Broker IDs of the in-sync replicas for this Partition.
-
#leader ⇒ Integer
ID of the Leader Broker for this Partition.
-
#replicas ⇒ Array<Integer>
Returns the Broker IDs of the Brokers with replicas of this Partition.
Instance Method Details
#error ⇒ nil, Kafka::ResponseError
Returns the error for the Partition as reported by the Broker.
26 27 28 29 30 |
# File 'lib/kafka/ffi/partition_metadata.rb', line 26 def error if self[:err] != :ok return ::Kafka::ResponseError.new(self[:err]) end end |
#id ⇒ Integer
Returns the Partition's ID
18 19 20 |
# File 'lib/kafka/ffi/partition_metadata.rb', line 18 def id self[:id] end |
#in_sync_replicas ⇒ Array<Integer>
Returns the Broker IDs of the in-sync replicas for this Partition.
53 54 55 56 57 58 59 |
# File 'lib/kafka/ffi/partition_metadata.rb', line 53 def in_sync_replicas if self[:isr_cnt] == 0 || self[:isrs].null? return [] end self[:isrs].read_array_of_int32(self[:isr_cnt]) end |
#leader ⇒ Integer
ID of the Leader Broker for this Partition
35 36 37 |
# File 'lib/kafka/ffi/partition_metadata.rb', line 35 def leader self[:leader] end |
#replicas ⇒ Array<Integer>
Returns the Broker IDs of the Brokers with replicas of this Partition.
42 43 44 45 46 47 48 |
# File 'lib/kafka/ffi/partition_metadata.rb', line 42 def replicas if self[:replica_cnt] == 0 || self[:replicas].null? return [] end self[:replicas].read_array_of_int32(self[:replica_cnt]) end |