Sha256: 65e72d4c8812f471860e13bd26536e59c16617a7e41601ec7886a771c2679379

Contents?: true

Size: 774 Bytes

Versions: 7

Compression:

Stored size: 774 Bytes

Contents

module Fluent
  class AzureStorageGen2Output
    class LZOCompressor < Compressor
      AzureStorageGen2Output.register_compressor('lzo', self)

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

      def configure(conf)
        super
        check_command('lzop', 'LZO')
      end

      def ext
        'lzo'.freeze
      end

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

      def compress(chunk, tmp)
        w = Tempfile.new("chunk-tmp")
        chunk.write_to(w)
        w.close

        # We don't check the return code because we can't recover lzop failure.
        system "lzop #{@command_parameter} -o #{tmp.path} #{w.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_lzo.rb
fluent-plugin-azurestorage-gen2-0.2.0 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb
fluent-plugin-azurestorage-gen2-0.1.6 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb
fluent-plugin-azurestorage-gen2-0.1.5 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb
fluent-plugin-azurestorage-gen2-0.1.4 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb
fluent-plugin-azurestorage-gen2-0.1.3 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb
fluent-plugin-azurestorage-gen2-0.1.2 lib/fluent/plugin/azurestorage_gen2_compressor_lzo.rb