Sha256: 8168e869ab8e7fbff13bcd0a2285a9d6b4c3f98783270c0a9fb2da1538eac61b

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 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")
        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

11 entries across 11 versions & 1 rubygems

Version Path
fluent-plugin-s3-0.6.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.6.0.pre1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.11 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.10 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.9 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.8 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.7 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.6 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.5 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.4 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-0.5.3 lib/fluent/plugin/s3_compressor_lzma2.rb