Use TermInfo in Snapshot serialization 72/114472/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 14 Nov 2024 08:33:35 +0000 (09:33 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 14 Nov 2024 08:34:23 +0000 (09:34 +0100)
Eliminate use of legacy methods in favorof talking to TermInfo directly.

JIRA: CONTROLLER-2127
Change-Id: I5a932c0b6bbc785b99e681168f2631b05cf0f900
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SS.java

index 11c5b2eba6de2f059b94942f7ef8dcd4e4b78893..151a06c47da79a3766f34076fb834594a976f43b 100644 (file)
@@ -43,8 +43,11 @@ final class SS implements Externalizable {
     public void writeExternal(final ObjectOutput out) throws IOException {
         WritableObjects.writeLongs(out, snapshot.getLastIndex(), snapshot.getLastTerm());
         WritableObjects.writeLongs(out, snapshot.getLastAppliedIndex(), snapshot.getLastAppliedTerm());
-        WritableObjects.writeLong(out, snapshot.getElectionTerm());
-        out.writeObject(snapshot.getElectionVotedFor());
+
+        final var termInfo = snapshot.termInfo();
+        WritableObjects.writeLong(out, termInfo.term());
+        out.writeObject(termInfo.votedFor());
+
         out.writeObject(snapshot.getServerConfiguration());
 
         final var unAppliedEntries = snapshot.getUnAppliedEntries();