Class: Fluent::EventRouter::Pipeline::FilterOptimizer

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/event_router.rb

Instance Method Summary collapse

Constructor Details

#initialize(filters = []) ⇒ FilterOptimizer

Returns a new instance of FilterOptimizer.



203
204
205
206
# File 'lib/fluent/event_router.rb', line 203

def initialize(filters = [])
  @filters = filters
  @optimizable = nil
end

Instance Method Details

#filter_stream(tag, es) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
# File 'lib/fluent/event_router.rb', line 213

def filter_stream(tag, es)
  if optimizable?
    optimized_filter_stream(tag, es)
  else
    @filters.reduce(es) { |acc, filter|
      filtered_es = filter.filter_stream(tag, acc)
      filter.measure_metrics(filtered_es)
      filtered_es
    }
  end
end

#filters=(filters) ⇒ Object



208
209
210
211
# File 'lib/fluent/event_router.rb', line 208

def filters=(filters)
  @filters = filters
  reset_optimization
end