Sha256: 80eb28c75c12c4eefda91fb2a73ac318c58554d483123ad6d23ff6a84348ef00

Contents?: true

Size: 773 Bytes

Versions: 51

Compression:

Stored size: 773 Bytes

Contents

module Fluent::Plugin
  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

51 entries across 51 versions & 3 rubygems

Version Path
fluent-plugin-s3-1.8.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.8.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.7.2 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.7.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.7.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.6.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.6.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.5.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.5.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-file-inclusion-1.4.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.4.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.3.4 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.3.3 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.3.2 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.3.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.3.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.2.1 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.2.0 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.1.11 lib/fluent/plugin/s3_compressor_lzma2.rb
fluent-plugin-s3-1.1.10 lib/fluent/plugin/s3_compressor_lzma2.rb