Class: PGPool::NodeInfo
- Inherits:
-
Object
- Object
- PGPool::NodeInfo
- Defined in:
- lib/pgpool/node_info.rb
Overview
class: NodeInfo, PORO
Constant Summary collapse
- INITIALIZING =
This state is only used during the initialization.
0
- UP_NO_CONNECTIONS =
Node is up. No connections yet.
1
- UP =
Node is up. Connections are pooled.
2
- DOWN =
Node is down.
3
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
- #down? ⇒ Boolean
-
#initialize(id, hostname, port, status, weight) ⇒ NodeInfo
constructor
A new instance of NodeInfo.
- #initializing? ⇒ Boolean
- #inspect ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
- #up? ⇒ Boolean
Constructor Details
#initialize(id, hostname, port, status, weight) ⇒ NodeInfo
Returns a new instance of NodeInfo.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pgpool/node_info.rb', line 28 def initialize(id, hostname, port, status, weight) @id = id.to_i @hostname = hostname @port = port.to_i @weight = weight.to_f self.status = status.to_i self end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
26 27 28 |
# File 'lib/pgpool/node_info.rb', line 26 def hostname @hostname end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26 27 28 |
# File 'lib/pgpool/node_info.rb', line 26 def id @id end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
26 27 28 |
# File 'lib/pgpool/node_info.rb', line 26 def port @port end |
#status ⇒ Object
Returns the value of attribute status.
26 27 28 |
# File 'lib/pgpool/node_info.rb', line 26 def status @status end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
26 27 28 |
# File 'lib/pgpool/node_info.rb', line 26 def weight @weight end |
Class Method Details
Instance Method Details
#initializing? ⇒ Boolean
39 40 41 |
# File 'lib/pgpool/node_info.rb', line 39 def initializing? status == INITIALIZING end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/pgpool/node_info.rb', line 55 def inspect to_hash.inspect end |
#to_hash ⇒ Object
51 52 53 |
# File 'lib/pgpool/node_info.rb', line 51 def to_hash { id: id, hostname: hostname, port: port, status: status, weight: weight } end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/pgpool/node_info.rb', line 59 def to_s inspect end |
#up? ⇒ Boolean
43 44 45 |
# File 'lib/pgpool/node_info.rb', line 43 def up? (status == UP || status == UP_NO_CONNECTIONS) end |