Class: Fluent::Plugin::WebHDFSOutput::LZOCommandCompressor

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

Instance Method Summary collapse

Methods inherited from Compressor

#initialise

Instance Method Details

#compress(chunk, tmp) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# 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

#configure(conf) ⇒ Object



8
9
10
11
# File 'lib/fluent/plugin/webhdfs_compressor_lzo_command.rb', line 8

def configure(conf)
  super
  check_command('lzop', 'LZO')
end

#extObject



13
14
15
# File 'lib/fluent/plugin/webhdfs_compressor_lzo_command.rb', line 13

def ext
  '.lzo'
end