Class: Raft::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/raft.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idsObject (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

#quorumObject



13
14
15
# File 'lib/raft.rb', line 13

def quorum
  @node_ids.count / 2 + 1 # integer division rounds down
end