Class: Droonga::Handler
- Inherits:
-
Object
- Object
- Droonga::Handler
- Includes:
- Pluggable
- Defined in:
- lib/droonga/handler.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(loop, options = {}) ⇒ Handler
constructor
A new instance of Handler.
- #prefer_synchronous?(command) ⇒ Boolean
- #process(message) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Methods included from Pluggable
Constructor Details
#initialize(loop, options = {}) ⇒ Handler
Returns a new instance of Handler.
32 33 34 35 36 37 38 |
# File 'lib/droonga/handler.rb', line 32 def initialize(loop, ={}) @loop = loop = @name = [:name] @database_name = [:database] prepare end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
30 31 32 |
# File 'lib/droonga/handler.rb', line 30 def context @context end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/droonga/handler.rb', line 30 def name @name end |
Instance Method Details
#prefer_synchronous?(command) ⇒ Boolean
58 59 60 |
# File 'lib/droonga/handler.rb', line 58 def prefer_synchronous?(command) find_plugin(command).prefer_synchronous?(command) end |
#process(message) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/droonga/handler.rb', line 62 def process() $log.trace("#{log_tag}: process: start") command = ["type"] plugin = find_plugin(command) if plugin.nil? $log.trace("#{log_tag}: process: done: no plugin: <#{command}>") return end process_command(plugin, command, ) $log.trace("#{log_tag}: process: done: <#{command}>", :plugin => plugin.class) end |
#shutdown ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/droonga/handler.rb', line 46 def shutdown $log.trace("#{log_tag}: shutdown: start") super @forwarder.shutdown if @database @database.close @context.close @database = @context = nil end $log.trace("#{log_tag}: shutdown: done") end |
#start ⇒ Object
40 41 42 43 44 |
# File 'lib/droonga/handler.rb', line 40 def start $log.trace("#{log_tag}: start: start") @forwarder.start $log.trace("#{log_tag}: start: done") end |