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.
51 52 53 54 55 |
# File 'lib/raft.rb', line 51 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.
49 50 51 |
# File 'lib/raft.rb', line 49 def current_term @current_term end |
#log ⇒ Object
Returns the value of attribute log.
49 50 51 |
# File 'lib/raft.rb', line 49 def log @log end |
#voted_for ⇒ Object
Returns the value of attribute voted_for.
49 50 51 |
# File 'lib/raft.rb', line 49 def voted_for @voted_for end |