Class: Kafka::LZ4Codec
- Inherits:
-
Object
- Object
- Kafka::LZ4Codec
- Defined in:
- lib/kafka/lz4_codec.rb
Instance Method Summary collapse
- #codec_id ⇒ Object
- #compress(data) ⇒ Object
- #decompress(data) ⇒ Object
- #load ⇒ Object
- #produce_api_min_version ⇒ Object
Instance Method Details
#codec_id ⇒ Object
5 6 7 |
# File 'lib/kafka/lz4_codec.rb', line 5 def codec_id 3 end |
#compress(data) ⇒ Object
19 20 21 |
# File 'lib/kafka/lz4_codec.rb', line 19 def compress(data) LZ4.encode(data) end |
#decompress(data) ⇒ Object
23 24 25 |
# File 'lib/kafka/lz4_codec.rb', line 23 def decompress(data) LZ4.decode(data) end |
#load ⇒ Object
13 14 15 16 17 |
# File 'lib/kafka/lz4_codec.rb', line 13 def load require "extlz4" rescue LoadError raise LoadError, "using lz4 compression requires adding a dependency on the `extlz4` gem to your Gemfile." end |
#produce_api_min_version ⇒ Object
9 10 11 |
# File 'lib/kafka/lz4_codec.rb', line 9 def produce_api_min_version 0 end |