Alleviate premature elections in followers
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / ReplicatedLog.java
index ffa4cb117231f3f603e2cd8a51db3853fd9b2fe8..e7f1be5ba3249788ad6bc38109541b53317955a2 100644 (file)
@@ -58,15 +58,18 @@ public interface ReplicatedLog {
      * reconstruct the state of the in-memory replicated log
      *
      * @param index the index of the first log entry to remove
+     * @return
      */
-    void removeFromAndPersist(long index);
+    boolean removeFromAndPersist(long index);
 
     /**
      * Appends an entry to the log.
      *
      * @param replicatedLogEntry the entry to append
+     * @return true if the entry was successfully appended, false otherwise. An entry can fail to append if
+     *         the index is already included in the log.
      */
-    void append(ReplicatedLogEntry replicatedLogEntry);
+    boolean append(ReplicatedLogEntry replicatedLogEntry);
 
     /**
      * Optimization method to increase the capacity of the journal log prior to appending entries.