Class: Fluent::Plugin::S3Output::GzipCompressor

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

Instance Attribute Summary

Attributes inherited from Compressor

#buffer_type, #log

Instance Method Summary collapse

Methods inherited from Compressor

#configure, #initialize

Constructor Details

This class inherits a constructor from Fluent::Plugin::S3Output::Compressor

Instance Method Details

#compress(chunk, tmp) ⇒ Object



654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/fluent/plugin/out_s3.rb', line 654

def compress(chunk, tmp)
  if @buffer_compressed_type == :gzip
    chunk.write_to(tmp, compressed: @buffer_compressed_type)
    return
  end

  w = Zlib::GzipWriter.new(tmp)
  chunk.write_to(w)
  w.finish
ensure
  if w
    w.finish rescue nil
  end
end

#content_typeObject



650
651
652
# File 'lib/fluent/plugin/out_s3.rb', line 650

def content_type
  'application/x-gzip'.freeze
end

#extObject



646
647
648
# File 'lib/fluent/plugin/out_s3.rb', line 646

def ext
  'gz'.freeze
end