Class: Droonga::Distributor

Inherits:
Object
  • Object
show all
Includes:
Pluggable
Defined in:
lib/droonga/distributor.rb

Instance Method Summary collapse

Methods included from Pluggable

#process, #processable?, #shutdown

Constructor Details

#initialize(dispatcher, options = {}) ⇒ Distributor

Returns a new instance of Distributor.



26
27
28
29
30
31
32
# File 'lib/droonga/distributor.rb', line 26

def initialize(dispatcher, options={})
  @dispatcher = dispatcher
  @plugins = []
  @options = options
  # TODO: don't put the default distributions
  load_plugins(options[:distributors] || ["search", "crud", "groonga", "watch"])
end

Instance Method Details

#distribute(components) ⇒ Object



34
35
36
37
38
# File 'lib/droonga/distributor.rb', line 34

def distribute(components)
  planner = DistributionPlanner.new(@dispatcher, components)
  planned_components = planner.plan
  @dispatcher.dispatch_components(planned_components)
end