class Flare::Tools::Cluster::NodeStat
Public Class Methods
new(stat)
click to toggle source
# File lib/flare/tools/cluster.rb, line 33 def initialize stat @stat = stat.dup end
Public Instance Methods
[](i)
click to toggle source
# File lib/flare/tools/cluster.rb, line 37 def [](i) @stat[i] end
[]=(i, v)
click to toggle source
# File lib/flare/tools/cluster.rb, line 41 def []=(i, v) @stat[i] = v.to_s end
active?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 57 def active? (state == StateActive) end
balance()
click to toggle source
# File lib/flare/tools/cluster.rb, line 81 def balance @stat['balance'].to_i end
down?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 65 def down? (state == StateDown) end
master?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 45 def master? (role == RoleMaster) end
method_missing(action, *args)
click to toggle source
# File lib/flare/tools/cluster.rb, line 85 def method_missing(action, *args) if @stat.has_key? action.to_s @stat[action.to_s] else @stat.__send__(action, *args) end end
partition()
click to toggle source
# File lib/flare/tools/cluster.rb, line 73 def partition @stat['partition'].to_i end
prepare?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 69 def prepare? (state == StatePrepare) end
proxy?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 53 def proxy? (role == RoleProxy) end
ready?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 61 def ready? (state == StateReady) end
slave?()
click to toggle source
# File lib/flare/tools/cluster.rb, line 49 def slave? (role == RoleSlave) end
thread_type()
click to toggle source
# File lib/flare/tools/cluster.rb, line 77 def thread_type @stat['thread_type'].to_i end