Class: Kafka::ZstdCodec

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/zstd_codec.rb

Instance Method Summary collapse

Instance Method Details

#codec_idObject



5
6
7
# File 'lib/kafka/zstd_codec.rb', line 5

def codec_id
  4
end

#compress(data) ⇒ Object



19
20
21
# File 'lib/kafka/zstd_codec.rb', line 19

def compress(data)
  Zstd.compress(data)
end

#decompress(data) ⇒ Object



23
24
25
# File 'lib/kafka/zstd_codec.rb', line 23

def decompress(data)
  Zstd.decompress(data)
end

#loadObject



13
14
15
16
17
# File 'lib/kafka/zstd_codec.rb', line 13

def load
  require "zstd-ruby"
rescue LoadError
  raise LoadError, "using zstd compression requires adding a dependency on the `zstd-ruby` gem to your Gemfile."
end

#produce_api_min_versionObject



9
10
11
# File 'lib/kafka/zstd_codec.rb', line 9

def produce_api_min_version
  7
end