Sha256: d1dd98c750f0edc97f95948a0a09515460d551cebcff47c6928be6c6f67b1e8d

Contents?: true

Size: 732 Bytes

Versions: 13

Compression:

Stored size: 732 Bytes

Contents

module Fluent::Plugin
  class WebHDFSOutput < Output
    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

13 entries across 13 versions & 1 rubygems

Version Path
fluent-plugin-webhdfs-1.3.2 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.3.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.3.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.5 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.4 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.3 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.2 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.2.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.1.1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.1.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-1.0.0 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb
fluent-plugin-webhdfs-0.6.0rc1 lib/fluent/plugin/webhdfs_compressor_lzo_command.rb