Class: Rdkafka::Admin::DescribeConfigsReport

Inherits:
Object
  • Object
show all
Defined in:
lib/rdkafka/admin/describe_configs_report.rb

Overview

Report for describe configs operation result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_entries:, entry_count:) ⇒ DescribeConfigsReport

Returns a new instance of DescribeConfigsReport.

Parameters:

  • config_entries (FFI::Pointer)

    pointer to the event-owned config entries array. It is only read here - the array is destroyed together with the result event by the background event callback, so this report must be built while the event is alive and must copy everything it needs into Ruby objects.

  • entry_count (Integer)

    number of config entries



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
# File 'lib/rdkafka/admin/describe_configs_report.rb', line 14

def initialize(config_entries:, entry_count:)
  @resources = []

  return if config_entries == FFI::Pointer::NULL

  config_entries
    .read_array_of_pointer(entry_count)
    .each { |config_resource_result_ptr| validate!(config_resource_result_ptr) }
    .each do |config_resource_result_ptr|
      config_resource_result = ConfigResourceBindingResult.new(config_resource_result_ptr)

      pointer_to_size_t = FFI::MemoryPointer.new(:size_t)
      configs_ptr = Bindings.rd_kafka_ConfigResource_configs(
        config_resource_result_ptr,
        pointer_to_size_t
      )

      configs_ptr
        .read_array_of_pointer(pointer_to_size_t.read_int)
        .map { |config_ptr| ConfigBindingResult.new(config_ptr) }
        .each { |config_binding| config_resource_result.configs << config_binding }

      @resources << config_resource_result
    end
end

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



7
8
9
# File 'lib/rdkafka/admin/describe_configs_report.rb', line 7

def resources
  @resources
end