Module: Roma::Command::BackgroundCommandReceiver
- Includes:
- VnodeCommandReceiver
- Included in:
- Receiver
- Defined in:
- lib/roma/command/bg_command_receiver.rb
Instance Method Summary collapse
- #ev_balance(s) ⇒ Object
- #ev_rbalance(s) ⇒ Object
-
#ev_recover(s) ⇒ Object
recover.
- #ev_release(s) ⇒ Object
-
#ev_rrecover(s) ⇒ Object
rrecover.
Methods included from VnodeCommandReceiver
#ev_reqpushv, #ev_spushv, #ev_spushv_protection, #req_push_a_vnode
Instance Method Details
#ev_balance(s) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/roma/command/bg_command_receiver.rb', line 11 def ev_balance(s) res = broadcast_cmd("rbalance\r\n") if @stats.run_join == false && @stats.run_recover == false && @stats.run_balance == false && @rttable.vnode_balance(@stats.ap_str)==:less Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_balance_process')) res[@stats.ap_str] = 'STARTED' else res[@stats.ap_str] = 'SERVER_ERROR Not unbalance or othre process is already running.' end send_data("#{res}\r\n") end |
#ev_rbalance(s) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/roma/command/bg_command_receiver.rb', line 25 def ev_rbalance(s) if @stats.run_join == false && @stats.run_recover == false && @stats.run_balance == false && @rttable.vnode_balance(@stats.ap_str)==:less Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_balance_process')) send_data("STARTED\r\n") else send_data("SERVER_ERROR Not unbalance or other process is already running.\r\n") end end |
#ev_recover(s) ⇒ Object
recover
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/roma/command/bg_command_receiver.rb', line 51 def ev_recover(s) if @rttable.can_i_recover? cmd = "rrecover" res = broadcast_cmd("#{cmd}\r\n") unless @stats.run_recover Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_recover_process')) res[@nid] = "STARTED" else res[@nid] = "SERVER_ERROR Recover process is already running." end send_data("#{res}\r\n") else send_data("SERVER_ERROR nodes num < redundant num\r\n") end end |
#ev_release(s) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/roma/command/bg_command_receiver.rb', line 37 def ev_release(s) if @stats.run_join == false && @stats.run_recover == false && @stats.run_balance == false && @stats.run_release == false && @stats.run_iterate_storage == false Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_release_process')) send_data("STARTED\r\n") else send_data("SERVER_ERROR Other process is already running.\r\n") end end |
#ev_rrecover(s) ⇒ Object
rrecover
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/roma/command/bg_command_receiver.rb', line 68 def ev_rrecover(s) if @rttable.can_i_recover? unless @stats.run_recover Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_recover_process')) send_data("STARTED\r\n") else send_data("SERVER_ERROR Recover process is already running.\r\n") end else send_data("SERVER_ERROR nodes num < redundant num\r\n") end end |