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()
ElectionTermgetCurrentTerm in interface ElectionTermpublic String getVotedFor()
ElectionTermgetVotedFor in interface ElectionTermpublic void update(long newTerm,
String newVotedFor)
ElectionTermupdate in interface ElectionTermnewTerm - the election term.newVotedFor - the candidate id that was voted for.public void updateAndPersist(long newTerm,
String newVotedFor)
ElectionTermupdateAndPersist in interface ElectionTermnewTerm - the election term.newVotedFor - the candidate id that was voted for.public static ElectionTerm copyOf(ElectionTerm from)
Copyright © 2019 OpenDaylight. All rights reserved.