Sha256: 75550bb5761835e0c3b8c391aa9dc81c0da990255c4de4fbe62653bf54837173

Contents?: true

Size: 940 Bytes

Versions: 6

Compression:

Stored size: 940 Bytes

Contents

module Rdkafka
  class Consumer
    # Information about a partition, used in {TopicPartitionList}.
    class Partition
      # Partition number
      # @return [Integer]
      attr_reader :partition

      # Partition's offset
      # @return [Integer]
      attr_reader :offset

      # @private
      def initialize(partition, offset)
        @partition = partition
        @offset = offset
      end

      # Human readable representation of this partition.
      # @return [String]
      def to_s
        "<Partition #{partition} with offset #{offset}>"
      end

      # Human readable representation of this partition.
      # @return [String]
      def inspect
        to_s
      end

      # Whether another partition is equal to this
      # @return [Boolean]
      def ==(other)
        self.class == other.class &&
          self.partition == other.partition &&
          self.offset == other.offset
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdkafka-0.3.5 lib/rdkafka/consumer/partition.rb
rdkafka-0.3.4 lib/rdkafka/consumer/partition.rb
rdkafka-0.3.3 lib/rdkafka/consumer/partition.rb
rdkafka-0.3.2 lib/rdkafka/consumer/partition.rb
rdkafka-0.3.1 lib/rdkafka/consumer/partition.rb
rdkafka-0.3.0 lib/rdkafka/consumer/partition.rb