Sha256: 75a4fd59dae8df91b82a08540d6720263673307a6be739028ba8c8204925db7d

Contents?: true

Size: 768 Bytes

Versions: 16

Compression:

Stored size: 768 Bytes

Contents

module Fluent
  class S3Output
    class LZMA2Compressor < Compressor
      S3Output.register_compressor('lzma2', self)

      config_param :command_parameter, :string, :default => '-qf0'

      def configure(conf)
        super
        check_command('xz', 'LZMA2')
      end

      def ext
        'xz'.freeze
      end

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

      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
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fluent-plugin-s3-0.8.2 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.8.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.8.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.8.0.rc1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.7.2 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.7.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.7.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.9 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.8 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.7 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.6 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.5 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.4 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.3 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.2 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.1 lib/fluent/plugin/s3_compressor_lzma2.rb