Class: Kafka::FFI::Admin::ConfigResource
- Inherits:
-
OpaquePointer
- Object
- OpaquePointer
- Kafka::FFI::Admin::ConfigResource
- Defined in:
- lib/kafka/ffi/admin/config_resource.rb
Instance Attribute Summary
Attributes inherited from OpaquePointer
Class Method Summary collapse
-
.new(type, name) ⇒ Object
Create a new ConfigResource.
Instance Method Summary collapse
-
#configs ⇒ Array<ConfigEntry>
Retrieve an array of ConfigEntry from the resource.
-
#destroy ⇒ Object
Destroy the ConfigResource, returning its resources back to the system.
-
#error ⇒ nil, Kafka::ResponseError
Returns the response error received from an AlterConfigs request.
-
#error_string ⇒ nil, String
Returns a string describing the error received for this resource during an AlterConfigs request.
-
#name ⇒ String
Returns the config option name.
-
#set_config(name, value) ⇒ Object
Set configuration name and value pair.
-
#type ⇒ Symbol
Returns the type of the resource.
Methods inherited from OpaquePointer
by_ref, from_native, inherited, #initialize, to_native
Constructor Details
This class inherits a constructor from Kafka::FFI::OpaquePointer
Class Method Details
.new(type, name) ⇒ Object
Create a new ConfigResource
19 20 21 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 19 def self.new(type, name) ::Kafka::FFI.rd_kafka_ConfigResource_new(type, name) end |
Instance Method Details
#configs ⇒ Array<ConfigEntry>
Retrieve an array of ConfigEntry from the resource.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 44 def configs count = ::FFI::MemoryPointer.new(:pointer) configs = ::Kafka::FFI.rd_kafka_ConfigResource_configs(self, count) if configs.null? return nil end configs = configs.read_array_of_pointer(count.read(:size_t)) configs.map! { |p| ConfigEntry.from_native(p, nil) } ensure count.free end |
#destroy ⇒ Object
Destroy the ConfigResource, returning its resources back to the system.
97 98 99 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 97 def destroy ::Kafka::FFI.rd_kafka_ConfigResource_destroy(self) end |
#error ⇒ nil, Kafka::ResponseError
Only set when ConfigResource was returned from AlterConfigs.
Returns the response error received from an AlterConfigs request.
80 81 82 83 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 80 def error err = ::Kafka::FFI.rd_kafka_ConfigResource_error(self) err == :ok ? nil : ::Kafka::ResponseError.new(err) end |
#error_string ⇒ nil, String
Only set when ConfigResource was returned from AlterConfigs.
Returns a string describing the error received for this resource during an AlterConfigs request.
92 93 94 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 92 def error_string ::Kafka::FFI.rd_kafka_ConfigResource_error_string(self) end |
#name ⇒ String
Returns the config option name
70 71 72 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 70 def name ::Kafka::FFI.rd_kafka_ConfigResource_name(self) end |
#set_config(name, value) ⇒ Object
This will overwrite the current value
Set configuration name and value pair
32 33 34 35 36 37 38 39 |
# File 'lib/kafka/ffi/admin/config_resource.rb', line 32 def set_config(name, value) err = ::Kafka::FFI.rd_kafka_ConfigResource_set_config(self, name, value) if err != :ok raise ::Kafka::ResponseError, err end nil end |