Sha256: 9e70146ba10232f8001cde34c17f68a56ab5bcddb8806e122030707598419df9

Contents?: true

Size: 718 Bytes

Versions: 8

Compression:

Stored size: 718 Bytes

Contents

module Fluent
  class WebHDFSOutput
    class LZOCommandCompressor < Compressor
      WebHDFSOutput.register_compressor('lzo_command', self)

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

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

      def ext
        '.lzo'
      end

      def compress(chunk, tmp)
        w = Tempfile.new("chunk-lzo-tmp-")
        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

8 entries across 8 versions & 1 rubygems

Version Path
fluent-plugin-webhdfs-0.7.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.7.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.6.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.6.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.5.3 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.5.2 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.5.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.5.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb