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.



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_termObject

Returns the value of attribute current_term.



49
50
51
# File 'lib/raft.rb', line 49

def current_term
  @current_term
end

#logObject

Returns the value of attribute log.



49
50
51
# File 'lib/raft.rb', line 49

def log
  @log
end

#voted_forObject

Returns the value of attribute voted_for.



49
50
51
# File 'lib/raft.rb', line 49

def voted_for
  @voted_for
end