Class: Fluent::S3Output::GzipCommandCompressor
- Inherits:
-
Compressor
- Object
- Compressor
- Fluent::S3Output::GzipCommandCompressor
- Defined in:
- lib/fluent/plugin/s3_compressor_gzip_command.rb
Instance Attribute Summary
Attributes inherited from Compressor
Instance Method Summary collapse
Instance Method Details
#compress(chunk, tmp) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/s3_compressor_gzip_command.rb', line 21 def compress(chunk, tmp) chunk_is_file = @buffer_type == 'file' path = if chunk_is_file chunk.path else w = Tempfile.new("chunk-gzip-tmp") chunk.write_to(w) w.close tmp.close w.path end # We don't check the return code because we can't recover gzip failure. system "gzip #{@command_parameter} -c #{path} > #{tmp.path}" ensure unless chunk_is_file w.close rescue nil w.unlink rescue nil end end |
#configure(conf) ⇒ Object
8 9 10 11 |
# File 'lib/fluent/plugin/s3_compressor_gzip_command.rb', line 8 def configure(conf) super check_command('gzip') end |
#content_type ⇒ Object
17 18 19 |
# File 'lib/fluent/plugin/s3_compressor_gzip_command.rb', line 17 def content_type 'application/x-gzip'.freeze end |
#ext ⇒ Object
13 14 15 |
# File 'lib/fluent/plugin/s3_compressor_gzip_command.rb', line 13 def ext 'gz'.freeze end |