Enhance code documentation and add TODOs
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / ElectionTerm.java
index 9c0a4fbffd5a03bf8e645e4d5aab9f72e66b507c..9f0d02edb9d5aa111b841f0972c0d82ca07a7df8 100644 (file)
@@ -30,9 +30,8 @@ public interface ElectionTerm {
     String getVotedFor();
 
     /**
-     * Called when we need to update the current term either because we received
-     * a message from someone with a more uptodate term or because we just voted
-     * for someone
+     * To be called mainly when we are recovering in-memory election state from
+     * persistent storage
      *
      * @param currentTerm
      * @param votedFor
@@ -40,6 +39,13 @@ public interface ElectionTerm {
     void update(long currentTerm, String votedFor);
 
     /**
+     * To be called when we need to update the current term either because we
+     * received a message from someone with a more up-to-date term or because we
+     * just voted for someone
+     * <p>
+     * This information needs to be persisted so that on recovery the replica
+     * can start itself in the right term and know if it has already voted in
+     * that term or not
      *
      * @param currentTerm
      * @param votedFor