Class: Fluent::AzureStorageGen2Output::LZMA2Compressor
- Inherits:
-
Compressor
- Object
- Compressor
- Fluent::AzureStorageGen2Output::LZMA2Compressor
- Defined in:
- lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
Instance Method Summary collapse
Instance Method Details
#compress(chunk, tmp) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb', line 21 def compress(chunk, tmp) w = Tempfile.new("chunk-xz-tmp") w.binmode chunk.write_to(w) w.close # We don't check the return code because we can't recover lzop failure. system "xz #{@command_parameter} -c #{w.path} > #{tmp.path}" ensure w.close rescue nil w.unlink rescue nil end |
#configure(conf) ⇒ Object
8 9 10 11 |
# File 'lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb', line 8 def configure(conf) super check_command('xz', 'LZMA2') end |
#content_type ⇒ Object
17 18 19 |
# File 'lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb', line 17 def content_type 'application/x-xz'.freeze end |
#ext ⇒ Object
13 14 15 |
# File 'lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb', line 13 def ext 'xz'.freeze end |