Module: Kafka::Compression

Defined in:
lib/kafka/compression.rb

Class Method Summary collapse

Class Method Details

.find_codec(name) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/kafka/compression.rb', line 6

def self.find_codec(name)
  case name
  when nil then nil
  when :snappy then SnappyCodec.new
  when :gzip then GzipCodec.new
  else raise "Unknown compression codec #{name}"
  end
end

.find_codec_by_id(codec_id) ⇒ Object


15
16
17
18
19
20
21
# File 'lib/kafka/compression.rb', line 15

def self.find_codec_by_id(codec_id)
  case codec_id
  when 1 then GzipCodec.new
  when 2 then SnappyCodec.new
  else raise "Unknown codec id #{codec_id}"
  end
end