Class: Flare::Tools::Cluster::NodeStat
- Inherits:
-
Object
- Object
- Flare::Tools::Cluster::NodeStat
show all
- Defined in:
- lib/flare/tools/cluster.rb
Instance Method Summary
collapse
Constructor Details
#initialize(stat) ⇒ NodeStat
Returns a new instance of NodeStat.
34
35
36
|
# File 'lib/flare/tools/cluster.rb', line 34
def initialize stat
@stat = stat.dup
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(action, *args) ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/flare/tools/cluster.rb', line 86
def method_missing(action, *args)
if @stat.has_key? action.to_s
@stat[action.to_s]
else
@stat.__send__(action, *args)
end
end
|
Instance Method Details
#[](i) ⇒ Object
38
39
40
|
# File 'lib/flare/tools/cluster.rb', line 38
def [](i)
@stat[i]
end
|
#[]=(i, v) ⇒ Object
42
43
44
|
# File 'lib/flare/tools/cluster.rb', line 42
def []=(i, v)
@stat[i] = v.to_s
end
|
#active? ⇒ Boolean
58
59
60
|
# File 'lib/flare/tools/cluster.rb', line 58
def active?
(state == StateActive)
end
|
#balance ⇒ Object
82
83
84
|
# File 'lib/flare/tools/cluster.rb', line 82
def balance
@stat['balance'].to_i
end
|
#down? ⇒ Boolean
66
67
68
|
# File 'lib/flare/tools/cluster.rb', line 66
def down?
(state == StateDown)
end
|
#master? ⇒ Boolean
46
47
48
|
# File 'lib/flare/tools/cluster.rb', line 46
def master?
(role == RoleMaster)
end
|
#partition ⇒ Object
74
75
76
|
# File 'lib/flare/tools/cluster.rb', line 74
def partition
@stat['partition'].to_i
end
|
#prepare? ⇒ Boolean
70
71
72
|
# File 'lib/flare/tools/cluster.rb', line 70
def prepare?
(state == StatePrepare)
end
|
#proxy? ⇒ Boolean
54
55
56
|
# File 'lib/flare/tools/cluster.rb', line 54
def proxy?
(role == RoleProxy)
end
|
#ready? ⇒ Boolean
62
63
64
|
# File 'lib/flare/tools/cluster.rb', line 62
def ready?
(state == StateReady)
end
|
#slave? ⇒ Boolean
50
51
52
|
# File 'lib/flare/tools/cluster.rb', line 50
def slave?
(role == RoleSlave)
end
|
#thread_type ⇒ Object
78
79
80
|
# File 'lib/flare/tools/cluster.rb', line 78
def thread_type
@stat['thread_type'].to_i
end
|