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 config entries array

  • entry_count (Integer) —

    number of config entries



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

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

#resources ⇒ Object (readonly)

Returns the value of attribute resources.



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

def resources
  @resources
end