Sha256: 6cada22a9cb50dc4dcf7b11ac7eb012802d41eb5d8cba0eb840142db1849bb22

Contents?: true

Size: 774 Bytes

Versions: 6

Compression:

Stored size: 774 Bytes

Contents

module Fluent
  class S3Output
    class LZOCompressor < Compressor
      S3Output.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", @tmp_dir)
        w.binmode
        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

6 entries across 6 versions & 1 rubygems

Version Path
fluent-plugin-s3-0.8.8 lib/fluent/plugin/s3_compressor_lzo.rb
fluent-plugin-s3-0.8.7 lib/fluent/plugin/s3_compressor_lzo.rb
fluent-plugin-s3-0.8.6 lib/fluent/plugin/s3_compressor_lzo.rb
fluent-plugin-s3-0.8.5 lib/fluent/plugin/s3_compressor_lzo.rb
fluent-plugin-s3-0.8.4 lib/fluent/plugin/s3_compressor_lzo.rb
fluent-plugin-s3-0.8.3 lib/fluent/plugin/s3_compressor_lzo.rb