Sha256: 23564d86a44b25de9c3754b8722350e042037c7bc4e0cc3f0e5a3a401548d9f5

Contents?: true

Size: 778 Bytes

Versions: 7

Compression:

Stored size: 778 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
fluent-plugin-azurestorage-gen2-0.2.1 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.2.0 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.1.6 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.1.5 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.1.4 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.1.3 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb
fluent-plugin-azurestorage-gen2-0.1.2 lib/fluent/plugin/azurestorage_gen2_compressor_lzma2.rb