X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FConfigParams.java;h=8d6b965d9bc7950727b47104da5b9a7db42dc3f1;hp=4c6434aec457db0b4899973f36effd0b37e7d14a;hb=b25ae9347455b1bae8f25424a9ceffc017f2f0db;hpb=eb887b1c2c8cd2768f8b4c2ed2b5054f97798466 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java index 4c6434aec4..8d6b965d9b 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java @@ -7,49 +7,136 @@ */ package org.opendaylight.controller.cluster.raft; +import javax.annotation.Nonnull; +import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import scala.concurrent.duration.FiniteDuration; /** * Configuration Parameter interface for configuring the Raft consensus system - *

+ * + *

* Any component using this implementation might want to provide an implementation of * this interface to configure * + *

* A default implementation will be used if none is provided. * * @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. + * + * @return the minimum number of entries. + */ + long getSnapshotBatchCount(); + + /** + * Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken. + * + * @return the percentage. + */ + int getSnapshotDataThresholdPercentage(); + + /** + * Returns the interval at which a heart beat message should be sent to remote followers. + * + * @return the interval as a FiniteDuration. + */ + FiniteDuration getHeartBeatInterval(); + + /** + * Returns the interval after which a new election should be triggered if no leader is available. + * + * @return the interval as a FiniteDuration. + */ + FiniteDuration getElectionTimeOutInterval(); + /** - * The minimum number of entries to be present in the in-memory Raft log - * for a snapshot to be taken + * Returns the maximum election time variance. The election is scheduled using both the election timeout + * and variance. * - * @return long + * @return the election time variance. */ - public long getSnapshotBatchCount(); + int getElectionTimeVariance(); /** - * The interval at which a heart beat message will be sent to the remote - * RaftActor + * Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader. * - * @return FiniteDuration + * @return the maximum size (in bytes). */ - public FiniteDuration getHeartBeatInterval(); + int getSnapshotChunkSize(); /** - * The interval in which a new election would get triggered if no leader is found + * Returns the maximum number of journal log entries to batch on recovery before applying. * - * Normally its set to atleast twice the heart beat interval + * @return the maximum number of journal log entries. + */ + int getJournalRecoveryLogBatchSize(); + + /** + * Returns the interval in which the leader needs to check if its isolated. + * + * @return the interval in ms. + */ + long getIsolatedCheckIntervalInMillis(); + + + /** + * Returns the multiplication factor to be used to determine the shard election timeout. The election timeout + * is determined by multiplying the election timeout factor with the heart beat duration. + * + * @return the election timeout factor. + */ + long getElectionTimeoutFactor(); + + + /** + * Returns the RaftPolicy used to determine certain Raft behaviors. + * + * @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy. + */ + @Nonnull + RaftPolicy getRaftPolicy(); + + /** + * Returns the PeerAddressResolver. + * + * @return the PeerAddressResolver instance. + */ + @Nonnull + PeerAddressResolver getPeerAddressResolver(); + + /** + * Returns the custom RaftPolicy class name. + * + * @return the RaftPolicy class name or null if none set. + */ + 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 FiniteDuration + * @return the threshold in terms of number of bytes. */ - public FiniteDuration getElectionTimeOutInterval(); + int getFileBackedStreamingThreshold(); /** - * The maximum election time variance. The election is scheduled using both - * the Election Timeout and Variance + * Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a + * 'not synced' transition. * - * @return int + * @return the threshold in terms of number of journal entries. */ - public int getElectionTimeVariance(); + long getSyncIndexThreshold(); }