Class: Fluent::UnitTimeFilterOutput::Buffer
- Inherits:
-
Object
- Object
- Fluent::UnitTimeFilterOutput::Buffer
- Includes:
- Enumerable
- Defined in:
- lib/fluent/plugin/unit_time_filter_buffer.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(options) ⇒ Buffer
constructor
A new instance of Buffer.
- #resume(tag, es) ⇒ Object
Constructor Details
#initialize(options) ⇒ Buffer
Returns a new instance of Buffer.
5 6 7 8 9 10 11 12 |
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 5 def initialize() @init_queue = [] @fiber = Fiber.new do |tag, es| @init_queue << [tag, es] run() end end |
Instance Method Details
#each ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 14 def each loop do tag, es = @init_queue.shift || Fiber.yield break unless (tag && es) es.each do |time, record| yield([tag, time, record]) end end end |
#resume(tag, es) ⇒ Object
25 26 27 |
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 25 def resume(tag, es) @fiber.resume(tag, es) end |