Class: Raft::Cluster
- Inherits:
-
Object
- Object
- Raft::Cluster
- Defined in:
- lib/raft.rb
Instance Attribute Summary collapse
-
#node_ids ⇒ Object
readonly
Returns the value of attribute node_ids.
Instance Method Summary collapse
-
#initialize(*node_ids) ⇒ Cluster
constructor
A new instance of Cluster.
- #quorum ⇒ Object
Constructor Details
#initialize(*node_ids) ⇒ Cluster
Returns a new instance of Cluster.
9 10 11 |
# File 'lib/raft.rb', line 9 def initialize(*node_ids) @node_ids = node_ids end |
Instance Attribute Details
#node_ids ⇒ Object (readonly)
Returns the value of attribute node_ids.
7 8 9 |
# File 'lib/raft.rb', line 7 def node_ids @node_ids end |
Instance Method Details
#quorum ⇒ Object
13 14 15 |
# File 'lib/raft.rb', line 13 def quorum @node_ids.count / 2 + 1 # integer division rounds down end |