Class: Rdkafka::Admin::ListOffsetsReport
- Inherits:
-
Object
- Object
- Rdkafka::Admin::ListOffsetsReport
- Defined in:
- lib/rdkafka/admin/list_offsets_report.rb
Overview
Report for list offsets operation result
Instance Attribute Summary collapse
-
#offsets ⇒ Object
readonly
Returns the value of attribute offsets.
Instance Method Summary collapse
-
#initialize(result_infos:, result_count:) ⇒ ListOffsetsReport
constructor
A new instance of ListOffsetsReport.
Constructor Details
#initialize(result_infos:, result_count:) ⇒ ListOffsetsReport
Returns a new instance of ListOffsetsReport.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rdkafka/admin/list_offsets_report.rb', line 11 def initialize(result_infos:, result_count:) @offsets = [] return if result_infos.null? result_infos .read_array_of_pointer(result_count) .each { |result_info_ptr| validate!(result_info_ptr) } .each do |result_info_ptr| tp_ptr = Bindings.rd_kafka_ListOffsetsResultInfo_topic_partition(result_info_ptr) tp = Bindings::TopicPartition.new(tp_ptr) = Bindings.(result_info_ptr) leader_epoch = Bindings.rd_kafka_topic_partition_get_leader_epoch(tp_ptr) @offsets << { topic: tp[:topic], partition: tp[:partition], offset: tp[:offset], timestamp: , leader_epoch: (leader_epoch == -1) ? nil : leader_epoch } end end |
Instance Attribute Details
#offsets ⇒ Object (readonly)
Returns the value of attribute offsets.
7 8 9 |
# File 'lib/rdkafka/admin/list_offsets_report.rb', line 7 def offsets @offsets end |