Class: HAProxyCluster::Server

Inherits:
StatsContainer show all
Defined in:
lib/haproxy_cluster/server.rb

Defined Under Namespace

Classes: Timeout

Constant Summary collapse

TYPE_ID =
2

Instance Attribute Summary collapse

Attributes inherited from StatsContainer

#stats

Instance Method Summary collapse

Methods inherited from StatsContainer

#method_missing, #monitor

Constructor Details

#initialize(stats, member = nil) ⇒ Server

Returns a new instance of Server.



8
9
10
11
# File 'lib/haproxy_cluster/server.rb', line 8

def initialize(stats,member = nil)
  @member = member
  super stats
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HAProxyCluster::StatsContainer

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



12
13
14
# File 'lib/haproxy_cluster/server.rb', line 12

def member
  @member
end

Instance Method Details

#backup?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/haproxy_cluster/server.rb', line 18

def backup?
  self.bck == 1
end

#disable!Object



30
31
32
# File 'lib/haproxy_cluster/server.rb', line 30

def disable!
  modify! :disable
end

#enable!Object



26
27
28
# File 'lib/haproxy_cluster/server.rb', line 26

def enable!
  modify! :enable
end

#nameObject



14
15
16
# File 'lib/haproxy_cluster/server.rb', line 14

def name
  self.svname 
end

#ok?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/haproxy_cluster/server.rb', line 22

def ok?
  self.status == 'UP'
end