*/
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;
* @author Kamal Rameshan
*/
public interface ConfigParams {
+ int MEGABYTE = 1048576;
+
/**
* Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.
*
*/
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.
*
*/
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.
*
* @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.
*/
- @Nonnull
- PeerAddressResolver getPeerAddressResolver();
+ @NonNull PeerAddressResolver getPeerAddressResolver();
/**
* Returns the custom RaftPolicy class name.
*/
String getCustomRaftPolicyImplementationClass();
+ /**
+ * Returns the directory in which to create temp files.
+ *
+ * @return the directory in which to create temp files.
+ */
+ @NonNull String getTempFileDirectory();
+
+ /**
+ * Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in
+ * memory to buffering to a file.
+ *
+ * @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();
}