Class: Fluent::Plugin::WebHDFSOutput::SnappyCompressor

Inherits:
Compressor
  • Object
show all
Defined in:
lib/fluent/plugin/webhdfs_compressor_snappy.rb

Instance Method Summary collapse

Methods inherited from Compressor

#configure, #initialise

Constructor Details

#initialize(options = {}) ⇒ SnappyCompressor

Returns a new instance of SnappyCompressor.



6
7
8
9
10
11
12
# File 'lib/fluent/plugin/webhdfs_compressor_snappy.rb', line 6

def initialize(options = {})
  begin
    require "snappy"
  rescue LoadError
    raise Fluent::ConfigError, "Install snappy before use snappy compressor"
  end
end

Instance Method Details

#compress(chunk, tmp) ⇒ Object



18
19
20
21
22
# File 'lib/fluent/plugin/webhdfs_compressor_snappy.rb', line 18

def compress(chunk, tmp)
  w = Snappy::Writer.new(tmp)
  chunk.write_to(w)
  w.close
end

#extObject



14
15
16
# File 'lib/fluent/plugin/webhdfs_compressor_snappy.rb', line 14

def ext
  ".sz"
end