Sha256: bd16a9e0c987b5332f9774e80bc88414f55542e35bb665bdec37e9af56805f0f

Contents?: true

Size: 211 Bytes

Versions: 1

Compression:

Stored size: 211 Bytes

Contents

require "zlib"

module Kafka
  class Partitioner
    def initialize(partitions)
      @partitions = partitions
    end

    def partition_for_key(key)
      Zlib.crc32(key) % @partitions.count
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-kafka-0.1.0.pre.beta1 lib/kafka/partitioner.rb