Skip to content

Commit 70ea5b4

Browse files
committed
use extlz4
1 parent c16cc8c commit 70ea5b4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/kafka/lz4_codec.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
module Kafka
22
class LZ4Codec
33
def initialize
4-
require "lz4-ruby"
4+
require "extlz4"
55
rescue LoadError
6-
raise LoadError, "using lz4 compression requires adding a dependency on the `lz4-ruby` gem to your Gemfile."
6+
raise LoadError, "using lz4 compression requires adding a dependency on the `extlz4` gem to your Gemfile."
77
end
88

99
def codec_id
1010
3
1111
end
1212

1313
def compress(data)
14-
LZ4::compress(data)
14+
LZ4.encode(data)
1515
end
1616

1717
def decompress(data)
18-
buffer = StringIO.new(data)
19-
LZ4::uncompress(buffer)
18+
LZ4.decode(data)
2019
end
2120
end
2221
end

ruby-kafka.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
3535
spec.add_development_dependency "rspec-benchmark"
3636
spec.add_development_dependency "activesupport"
3737
spec.add_development_dependency "snappy"
38-
spec.add_development_dependency "lz4-ruby"
38+
spec.add_development_dependency "extlz4"
3939
spec.add_development_dependency "colored"
4040
spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
4141
spec.add_development_dependency "dogstatsd-ruby", ">= 3.0.0"

0 commit comments

Comments
 (0)