public final class ImmutableElectionTerm extends Object implements ElectionTerm
Modifier and Type | Method and Description |
---|---|
static ElectionTerm |
copyOf(ElectionTerm from) |
long |
getCurrentTerm()
Returns the current leader's Raft term.
|
String |
getVotedFor()
Returns the id of the candidate that this server voted for in current term.
|
String |
toString() |
void |
update(long newTerm,
String newVotedFor)
This method updates the in-memory election term state.
|
void |
updateAndPersist(long newTerm,
String newVotedFor)
This method updates the in-memory election term state and persists it so it can be recovered on next restart.
|
public long getCurrentTerm()
ElectionTerm
getCurrentTerm
in interface ElectionTerm
public String getVotedFor()
ElectionTerm
getVotedFor
in interface ElectionTerm
public void update(long newTerm, String newVotedFor)
ElectionTerm
update
in interface ElectionTerm
newTerm
- the election term.newVotedFor
- the candidate id that was voted for.public void updateAndPersist(long newTerm, String newVotedFor)
ElectionTerm
updateAndPersist
in interface ElectionTerm
newTerm
- the election term.newVotedFor
- the candidate id that was voted for.public static ElectionTerm copyOf(ElectionTerm from)
Copyright © 2019 OpenDaylight. All rights reserved.