Allow incremental recovery
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / ConfigParams.java
index 86ce3113fab53e9f66d64db0fa4d793fd08fc010..c5c78130e8fcb22c5c614a03032a74acae40a2bc 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
  */
 package org.opendaylight.controller.cluster.raft;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
 import scala.concurrent.duration.FiniteDuration;
 
 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
 import scala.concurrent.duration.FiniteDuration;
 
@@ -40,6 +40,15 @@ public interface ConfigParams {
      */
     int getSnapshotDataThresholdPercentage();
 
      */
     int getSnapshotDataThresholdPercentage();
 
+
+    /**
+     * Returns the interval(in seconds) after which a snapshot should be taken during recovery.
+     * Negative value means don't take snapshots.
+     *
+     * @return the interval of recovery snapshot in seconds
+     */
+    int getRecoverySnapshotIntervalSeconds();
+
     /**
      * Returns the interval at which a heart beat message should be sent to remote followers.
      *
     /**
      * Returns the interval at which a heart beat message should be sent to remote followers.
      *
@@ -54,6 +63,14 @@ public interface ConfigParams {
      */
     FiniteDuration getElectionTimeOutInterval();
 
      */
     FiniteDuration getElectionTimeOutInterval();
 
+    /**
+     * Returns the number by which a candidate should divide the election timeout it has calculated. This serves
+     * to speed up retries when elections result in a stalemate.
+     *
+     * @return the interval as a FiniteDuration.
+     */
+    long getCandidateElectionTimeoutDivisor();
+
     /**
      * Returns the maximum election time variance. The election is scheduled using both the election timeout
      * and variance.
     /**
      * Returns the maximum election time variance. The election is scheduled using both the election timeout
      * and variance.
@@ -98,16 +115,14 @@ public interface ConfigParams {
      *
      * @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
      */
      *
      * @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
      */
-    @Nonnull
-    RaftPolicy getRaftPolicy();
+    @NonNull RaftPolicy getRaftPolicy();
 
     /**
      * Returns the PeerAddressResolver.
      *
      * @return the PeerAddressResolver instance.
      */
 
     /**
      * Returns the PeerAddressResolver.
      *
      * @return the PeerAddressResolver instance.
      */
-    @Nonnull
-    PeerAddressResolver getPeerAddressResolver();
+    @NonNull PeerAddressResolver getPeerAddressResolver();
 
     /**
      * Returns the custom RaftPolicy class name.
 
     /**
      * Returns the custom RaftPolicy class name.
@@ -121,8 +136,7 @@ public interface ConfigParams {
      *
      * @return the directory in which to create temp files.
      */
      *
      * @return the directory in which to create temp files.
      */
-    @Nonnull
-    String getTempFileDirectory();
+    @NonNull String getTempFileDirectory();
 
     /**
      * Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in
 
     /**
      * Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in
@@ -131,4 +145,12 @@ public interface ConfigParams {
      * @return the threshold in terms of number of bytes.
      */
     int getFileBackedStreamingThreshold();
      * @return the threshold in terms of number of bytes.
      */
     int getFileBackedStreamingThreshold();
+
+    /**
+     * Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a
+     * 'not synced' transition.
+     *
+     * @return the threshold in terms of number of journal entries.
+     */
+    long getSyncIndexThreshold();
 }
 }