class Fluent::Plugin::WebHDFSOutput::LZOCommandCompressor

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method
# File lib/fluent/plugin/webhdfs_compressor_lzo_command.rb, line 8
def initialize(options = {})
  super()
  check_command('lzop', 'LZO')
end

Public Instance Methods

compress(chunk, tmp) click to toggle source
# File lib/fluent/plugin/webhdfs_compressor_lzo_command.rb, line 17
def compress(chunk, tmp)
  w = Tempfile.new("chunk-lzo-tmp-")
  w.binmode
  chunk.write_to(w)
  w.close

  # We don't check the return code because we can't recover lzop failure.
  system "lzop #{@command_parameter} -o #{tmp.path} #{w.path}"
ensure
  w.close rescue nil
  w.unlink rescue nil
end
ext() click to toggle source
# File lib/fluent/plugin/webhdfs_compressor_lzo_command.rb, line 13
def ext
  '.lzo'
end