Class: Rdkafka::Admin::DescribeConfigsReport

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_entries:, entry_count:) ⇒ DescribeConfigsReport

Returns a new instance of DescribeConfigsReport.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rdkafka/admin/describe_configs_report.rb', line 8

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(:int32)
      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
ensure
  return if config_entries == FFI::Pointer::NULL

  Bindings.rd_kafka_ConfigResource_destroy_array(config_entries, entry_count)
end

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



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

def resources
  @resources
end