module Roma::Command::UtilCommandReceiver
Public Instance Methods
async_broadcast_cmd(cmd,without_nids=nil)
click to toggle source
# File lib/roma/command/util_command_receiver.rb 52 def async_broadcast_cmd(cmd,without_nids=nil) 53 without_nids=[@stats.ap_str] unless without_nids 54 res = {} 55 @rttable.nodes.each{ |nid| 56 res[nid] = async_send_cmd(nid,cmd) unless without_nids.include?(nid) 57 } 58 res 59 rescue => e 60 @log.error("#{e}\n#{$@}") 61 nil 62 end
async_send_cmd(nid, cmd)
click to toggle source
# File lib/roma/command/util_command_receiver.rb 34 def async_send_cmd(nid, cmd) 35 con = Roma::Messaging::ConPool.instance.get_connection(nid) 36 con.write(cmd) 37 res = con.gets 38 Roma::Messaging::ConPool.instance.return_connection(nid, con) 39 if res 40 res.chomp! 41 @rttable.proc_succeed(nid) 42 else 43 @rttable.proc_failed(nid) 44 end 45 res 46 rescue => e 47 @rttable.proc_failed(nid) 48 @log.error("#{e}\n#{$@}") 49 nil 50 end
broadcast_cmd(cmd)
click to toggle source
# File lib/roma/command/util_command_receiver.rb 26 def broadcast_cmd(cmd) 27 res={} 28 @rttable.nodes.each{|nid| 29 res[nid] = send_cmd(nid,cmd) if nid != @stats.ap_str 30 } 31 res 32 end
chg_time_expt(expt)
click to toggle source
change to actual time for a memcached's expire time value
# File lib/roma/command/util_command_receiver.rb 65 def chg_time_expt(expt) 66 if expt == 0 67 expt = 0x7fffffff 68 elsif expt < 2592000 69 expt += Time.now.to_i 70 end 71 expt 72 end
send_cmd(nid, cmd)
click to toggle source
# File lib/roma/command/util_command_receiver.rb 8 def send_cmd(nid, cmd) 9 con = get_connection(nid) 10 con.send(cmd) 11 res = con.gets 12 if res == nil 13 @rttable.proc_failed(nid) 14 return nil 15 elsif res.start_with?("ERROR") == false 16 @rttable.proc_succeed(nid) 17 return_connection(nid, con) 18 end 19 res.chomp 20 rescue => e 21 @rttable.proc_failed(nid) 22 @log.error("#{e}\n#{$@}") 23 nil 24 end