Sha256: 60b29d33ed16bdddf56e3195e397239fcfcd0c5d4db468b97f119a4a55d1d1a6

Contents?: true

Size: 543 Bytes

Versions: 6

Compression:

Stored size: 543 Bytes

Contents

module Fluent
  class WebHDFSOutput < Fluent::TimeSlicedOutput
    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)
        w = Snappy::Writer.new(tmp)
        chunk.write_to(w)
        w.close
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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