Class: Raft::PersistentState

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

Overview

Struct.new(:current_term, :voted_for, :log)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePersistentState

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_termObject

Returns the value of attribute current_term.



33
34
35
# File 'lib/raft.rb', line 33

def current_term
  @current_term
end

#logObject

Returns the value of attribute log.



33
34
35
# File 'lib/raft.rb', line 33

def log
  @log
end

#voted_forObject

Returns the value of attribute voted_for.



33
34
35
# File 'lib/raft.rb', line 33

def voted_for
  @voted_for
end