EventStream from entries: numbers of pairs of time and record.
This class can handle many events more efficiently than ArrayEventStream because this class generate less objects than ArrayEventStream.
Use this class as below, in loop of data-enumeration:
1. initialize blank stream: streams[tag] ||= MultiEventStream 2. add events stream[tag].add(time, record)
# File lib/fluent/event.rb, line 98 def initialize @time_array = [] @record_array = [] end
# File lib/fluent/event.rb, line 111 def add(time, record) @time_array << time @record_array << record end
# File lib/fluent/event.rb, line 103 def dup es = MultiEventStream.new @time_array.zip(@record_array).each { |time, record| es.add(time, record.dup) } es end
# File lib/fluent/event.rb, line 124 def each(&block) time_array = @time_array record_array = @record_array for i in 0..time_array.length-1 block.call(time_array[i], record_array[i]) end nil end
# File lib/fluent/event.rb, line 120 def empty? @time_array.empty? end
# File lib/fluent/event.rb, line 116 def repeatable? true end