- * 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
+ * This method updates the in-memory election term state. This method should be called when recovering election
+ * state from persistent storage.
+ *
+ * @param term the election term.
+ * @param votedFor the candidate id that was voted for.
+ */
+ void update(long term, @Nullable String votedFor);
+
+ /**
+ * This method updates the in-memory election term state and persists it so it can be recovered on next restart.
+ * This method should be called when starting a new election or when a Raft RPC message is received with a higher
+ * term.