Sha256: aaab46f7ec5cb3e5c217a721024ad9f539435c8dfc5cdf29dc83162d214441f5

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

module Fluent
  class AzureStorageOutput
    class LZMA2Compressor < Compressor
      AzureStorageOutput.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

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-azurestorage-0.1.0 lib/fluent/plugin/azurestorage_compressor_lzma2.rb
fluent-plugin-azurestorage-0.0.8 lib/fluent/plugin/azurestorage_compressor_lzma2.rb