Class: Raft::PersistentState
- Inherits:
-
Object
- Object
- Raft::PersistentState
- Defined in:
- lib/raft.rb
Overview
Struct.new(:current_term, :voted_for, :log)
Instance Attribute Summary collapse
-
#current_term ⇒ Object
Returns the value of attribute current_term.
-
#log ⇒ Object
Returns the value of attribute log.
-
#voted_for ⇒ Object
Returns the value of attribute voted_for.
Instance Method Summary collapse
-
#initialize ⇒ PersistentState
constructor
A new instance of PersistentState.
Constructor Details
#initialize ⇒ PersistentState
Returns a new instance of PersistentState.
35 36 37 38 39 |
# File 'lib/raft.rb', line 35 def initialize @current_term = 0 @voted_for = nil @log = Log.new([]) end |
Instance Attribute Details
#current_term ⇒ Object
Returns the value of attribute current_term.
33 34 35 |
# File 'lib/raft.rb', line 33 def current_term @current_term end |
#log ⇒ Object
Returns the value of attribute log.
33 34 35 |
# File 'lib/raft.rb', line 33 def log @log end |
#voted_for ⇒ Object
Returns the value of attribute voted_for.
33 34 35 |
# File 'lib/raft.rb', line 33 def voted_for @voted_for end |