Module: Kafka::Digest

Defined in:
lib/kafka/digest.rb

Constant Summary collapse

FUNCTIONS_BY_NAME =
{
  :crc32 => Crc32Hash.new,
  :murmur2 => Murmur2Hash.new
}.freeze

Class Method Summary collapse

Class Method Details

.find_digest(name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/kafka/digest.rb', line 13

def self.find_digest(name)
  digest = FUNCTIONS_BY_NAME.fetch(name) do
    raise LoadError, "Unknown hash function #{name}"
  end

  digest.load
  digest
end