Class: Rdkafka::Consumer::Partition
- Inherits:
-
Object
- Object
- Rdkafka::Consumer::Partition
- Defined in:
- lib/rdkafka/consumer/partition.rb
Overview
Information about a partition, used in TopicPartitionList.
Instance Attribute Summary collapse
-
#err ⇒ Integer
readonly
Partition’s error code.
-
#offset ⇒ Integer?
readonly
Partition’s offset.
-
#partition ⇒ Integer
readonly
Partition number.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Whether another partition is equal to this.
-
#initialize(partition, offset, err = Rdkafka::Bindings::RD_KAFKA_RESP_ERR_NO_ERROR) ⇒ Partition
constructor
A new instance of Partition.
-
#inspect ⇒ String
Human readable representation of this partition.
-
#to_s ⇒ String
Human readable representation of this partition.
Constructor Details
#initialize(partition, offset, err = Rdkafka::Bindings::RD_KAFKA_RESP_ERR_NO_ERROR) ⇒ Partition
Returns a new instance of Partition.
23 24 25 26 27 |
# File 'lib/rdkafka/consumer/partition.rb', line 23 def initialize(partition, offset, err = Rdkafka::Bindings::RD_KAFKA_RESP_ERR_NO_ERROR) @partition = partition @offset = offset @err = err end |
Instance Attribute Details
#err ⇒ Integer (readonly)
Partition’s error code
17 18 19 |
# File 'lib/rdkafka/consumer/partition.rb', line 17 def err @err end |
#offset ⇒ Integer? (readonly)
Partition’s offset
13 14 15 |
# File 'lib/rdkafka/consumer/partition.rb', line 13 def offset @offset end |
#partition ⇒ Integer (readonly)
Partition number
9 10 11 |
# File 'lib/rdkafka/consumer/partition.rb', line 9 def partition @partition end |
Instance Method Details
#==(other) ⇒ Boolean
Whether another partition is equal to this
48 49 50 51 52 |
# File 'lib/rdkafka/consumer/partition.rb', line 48 def ==(other) self.class == other.class && partition == other.partition && offset == other.offset end |
#inspect ⇒ String
Human readable representation of this partition.
41 42 43 |
# File 'lib/rdkafka/consumer/partition.rb', line 41 def inspect to_s end |
#to_s ⇒ String
Human readable representation of this partition.
31 32 33 34 35 36 37 |
# File 'lib/rdkafka/consumer/partition.rb', line 31 def to_s = "<Partition #{partition}" += " offset=#{offset}" if offset += " err=#{err}" if err != Rdkafka::Bindings::RD_KAFKA_RESP_ERR_NO_ERROR += ">" end |