Sha256: 32de540b124c5efbdcf47c7da3dea2aa0ac71f869800d630f95bfcdf3b6302b6

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

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, nil]
      attr_reader :offset

      # Partition's error code
      # @return [Integer]
      attr_reader :err

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

      # Human readable representation of this partition.
      # @return [String]
      def to_s
        message = "<Partition #{partition}"
        message += " offset=#{offset}" if offset
        message += " err=#{err}" if err != 0
        message += ">"
        message
      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

21 entries across 21 versions & 2 rubygems

Version Path
rdkafka-0.12.1 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.4 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.3 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.2 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.1 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.1.beta1 lib/rdkafka/consumer/partition.rb
karafka-rdkafka-0.12.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0.beta.4 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0.beta.3 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0.beta.2 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0.beta.1 lib/rdkafka/consumer/partition.rb
rdkafka-0.12.0.beta.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.11.1 lib/rdkafka/consumer/partition.rb
rdkafka-0.11.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.10.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.9.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.8.1 lib/rdkafka/consumer/partition.rb
rdkafka-0.8.0 lib/rdkafka/consumer/partition.rb
rdkafka-0.8.0.beta.1 lib/rdkafka/consumer/partition.rb