class Fluent::CompressedMessagePackEventStream

Public Class Methods

new(data, cached_unpacker = nil, size = 0, unpacked_times: nil, unpacked_records: nil) click to toggle source
Calls superclass method Fluent::MessagePackEventStream::new
# File lib/fluent/event.rb, line 271
def initialize(data, cached_unpacker = nil, size = 0, unpacked_times: nil, unpacked_records: nil)
  super
  @decompressed_data = nil
  @compressed_data = data
end

Public Instance Methods

each(unpacker: nil, &block) click to toggle source
Calls superclass method Fluent::MessagePackEventStream#each
# File lib/fluent/event.rb, line 287
def each(unpacker: nil, &block)
  ensure_decompressed!
  super
end
empty?() click to toggle source
Calls superclass method Fluent::MessagePackEventStream#empty?
# File lib/fluent/event.rb, line 277
def empty?
  ensure_decompressed!
  super
end
ensure_unpacked!(unpacker: nil) click to toggle source
# File lib/fluent/event.rb, line 282
def ensure_unpacked!(unpacker: nil)
  ensure_decompressed!
  super
end
to_compressed_msgpack_stream(time_int: false) click to toggle source
# File lib/fluent/event.rb, line 297
def to_compressed_msgpack_stream(time_int: false)
  # time_int is always ignored because @data is always packed binary in this class
  @compressed_data
end
to_msgpack_stream(time_int: false, packer: nil) click to toggle source
# File lib/fluent/event.rb, line 292
def to_msgpack_stream(time_int: false, packer: nil)
  ensure_decompressed!
  super
end

Private Instance Methods

ensure_decompressed!() click to toggle source
# File lib/fluent/event.rb, line 304
def ensure_decompressed!
  return if @decompressed_data
  @data = @decompressed_data = decompress(@data)
end