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



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

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(envelope) ⇒ Object



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

def distribute(envelope)
  command = envelope["type"]
  process(command, envelope)
end

#post(message) ⇒ Object



38
39
40
# File 'lib/droonga/distributor.rb', line 38

def post(message)
  @dispatcher.handle(message, [])
end