Sha256: ca0d8189f9bebef177999f6e8ba07c5bdb31482818d8ed17c4fe632e09acbed1

Contents?: true

Size: 550 Bytes

Versions: 4

Compression:

Stored size: 550 Bytes

Contents

module Fluent::Plugin
  class WebHDFSOutput < Output
    class SnappyCompressor < Compressor
      WebHDFSOutput.register_compressor('snappy', self)

      def initialize(options = {})
        begin
          require "snappy"
        rescue LoadError
          raise Fluent::ConfigError, "Install snappy before use snappy compressor"
        end
      end

      def ext
        ".sz"
      end

      def compress(chunk, tmp)
        Snappy::Writer.new(tmp) do |w|
          w << chunk.read
          w.flush
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluent-plugin-webhdfs-1.3.2 lib/fluent/plugin/webhdfs_compressor_snappy.rb
fluent-plugin-webhdfs-1.3.1 lib/fluent/plugin/webhdfs_compressor_snappy.rb
fluent-plugin-webhdfs-1.3.0 lib/fluent/plugin/webhdfs_compressor_snappy.rb
fluent-plugin-webhdfs-1.2.5 lib/fluent/plugin/webhdfs_compressor_snappy.rb