Class: Fluent::Plugin::WebHDFSOutput::LZOCommandCompressor
- Inherits:
-
Compressor
- Object
- Compressor
- Fluent::Plugin::WebHDFSOutput::LZOCommandCompressor
- Defined in:
- lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
Instance Method Summary collapse
- #compress(chunk, tmp) ⇒ Object
- #ext ⇒ Object
-
#initialize(options = {}) ⇒ LZOCommandCompressor
constructor
A new instance of LZOCommandCompressor.
Methods inherited from Compressor
Constructor Details
#initialize(options = {}) ⇒ LZOCommandCompressor
Returns a new instance of LZOCommandCompressor.
8 9 10 11 |
# File 'lib/fluent/plugin/webhdfs_compressor_lzo_command.rb', line 8 def initialize( = {}) super() check_command('lzop', 'LZO') end |
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 |
#ext ⇒ Object
13 14 15 |
# File 'lib/fluent/plugin/webhdfs_compressor_lzo_command.rb', line 13 def ext '.lzo' end |