Class: Rdkafka::Consumer::Partition

Inherits:
Object
  • Object
show all
Defined in:
lib/rdkafka/consumer/partition.rb

Overview

Information about a partition, used in TopicPartitionList.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errInteger (readonly)

Partition’s error code

Returns:

  • (Integer)


17
18
19
# File 'lib/rdkafka/consumer/partition.rb', line 17

def err
  @err
end

#offsetInteger? (readonly)

Partition’s offset

Returns:

  • (Integer, nil)


13
14
15
# File 'lib/rdkafka/consumer/partition.rb', line 13

def offset
  @offset
end

#partitionInteger (readonly)

Partition number

Returns:

  • (Integer)


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

Returns:

  • (Boolean)


44
45
46
47
48
# File 'lib/rdkafka/consumer/partition.rb', line 44

def ==(other)
  self.class == other.class &&
    self.partition == other.partition &&
    self.offset == other.offset
end

#inspectString

Human readable representation of this partition.

Returns:

  • (String)


38
39
40
# File 'lib/rdkafka/consumer/partition.rb', line 38

def inspect
  to_s
end

#to_sString

Human readable representation of this partition.

Returns:

  • (String)


28
29
30
31
32
33
34
# File 'lib/rdkafka/consumer/partition.rb', line 28

def to_s
  message = "<Partition #{partition}"
  message += " offset=#{offset}" if offset
  message += " err=#{err}" if err != 0
  message += ">"
  message
end