Class: Droonga::HandlerRunner
- Inherits:
-
Object
- Object
- Droonga::HandlerRunner
- Includes:
- Loggable
- Defined in:
- lib/droonga/handler_runner.rb
Instance Method Summary collapse
- #change_schema?(type) ⇒ Boolean
-
#initialize(loop, options = {}) ⇒ HandlerRunner
constructor
A new instance of HandlerRunner.
- #prefer_synchronous?(type) ⇒ Boolean
- #process(message) ⇒ Object
- #processable?(type) ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(loop, options = {}) ⇒ HandlerRunner
Returns a new instance of HandlerRunner.
27 28 29 30 31 32 33 34 35 |
# File 'lib/droonga/handler_runner.rb', line 27 def initialize(loop, ={}) @loop = loop @options = @name = [:name] @label = [:label] @dataset_name = [:dataset] @database_name = [:database] prepare end |
Instance Method Details
#change_schema?(type) ⇒ Boolean
48 49 50 |
# File 'lib/droonga/handler_runner.rb', line 48 def change_schema?(type) find_handler_class(type).action.change_schema? end |
#prefer_synchronous?(type) ⇒ Boolean
52 53 54 |
# File 'lib/droonga/handler_runner.rb', line 52 def prefer_synchronous?(type) find_handler_class(type).action.synchronous? end |
#process(message) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/droonga/handler_runner.rb', line 60 def process() logger.trace("process: start") type = ["type"] if type == "database.reopen" handler_class = nil reopen else handler_class = find_handler_class(type) if handler_class.nil? logger.trace("process: done: no handler: <#{type}>") return end process_type(handler_class, type, ) end logger.trace("process: done: <#{type}>", :handler => handler_class) end |
#processable?(type) ⇒ Boolean
56 57 58 |
# File 'lib/droonga/handler_runner.rb', line 56 def processable?(type) not find_handler_class(type).nil? end |
#shutdown ⇒ Object
42 43 44 45 46 |
# File 'lib/droonga/handler_runner.rb', line 42 def shutdown logger.trace("shutdown: start") close_database if @database logger.trace("shutdown: done") end |
#start ⇒ Object
37 38 39 40 |
# File 'lib/droonga/handler_runner.rb', line 37 def start logger.trace("start: start") logger.trace("start: done") end |