Class: Fluent::MetadataTimeEventStream

Inherits:
EventStream show all
Defined in:
lib/fluent/event.rb

Constant Summary

Constants included from Plugin::Compressable

Plugin::Compressable::DEFAULT_DECOMPRESSION_SIZE_LIMIT

Instance Method Summary collapse

Methods inherited from EventStream

#==, #to_compressed_msgpack_stream, #to_msgpack_stream, #to_msgpack_stream_forced_integer

Methods included from Plugin::Compressable

#compress, #decompress

Constructor Details

#initialize(es) ⇒ MetadataTimeEventStream

Returns a new instance of MetadataTimeEventStream.



313
314
315
# File 'lib/fluent/event.rb', line 313

def initialize(es)
  @es = es
end

Instance Method Details

#dup ⇒ Object



321
322
323
# File 'lib/fluent/event.rb', line 321

def dup
  self.class.new(@es.dup)
end

#each(unpacker: nil, &block) ⇒ Object



337
338
339
340
341
342
343
344
345
346
# File 'lib/fluent/event.rb', line 337

def each(unpacker: nil, &block)
  @es.each(unpacker: unpacker) do |time, record|
    next if record.nil?

    time = time[0] if time.is_a?(Array)
    time = Fluent::EventTime.now if time.nil? || time.to_i == 0
    block.call(time, record)
  end
  nil
end

#empty? ⇒ Boolean

Returns:

  • (Boolean)


317
318
319
# File 'lib/fluent/event.rb', line 317

def empty?
  @es.empty?
end

#repeatable? ⇒ Boolean

Returns:

  • (Boolean)


329
330
331
# File 'lib/fluent/event.rb', line 329

def repeatable?
  @es.repeatable?
end

#size ⇒ Object



325
326
327
# File 'lib/fluent/event.rb', line 325

def size
  @es.size
end

#slice(index, num) ⇒ Object



333
334
335
# File 'lib/fluent/event.rb', line 333

def slice(index, num)
  self.class.new(@es.slice(index, num))
end