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=0e701e3aa55eb00b1d49be1d2fbd3cd6704827c3;hp=433c3f7e4b832d081de375e8b792f19f1ca4caa4;hb=000960f6451af770f5463e41e1fb6defb6f3ab27;hpb=032371baa081315920e52a7806ea09676e47316b 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 433c3f7e4b..0e701e3aa5 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,65 +7,111 @@ */ 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 { /** - * The minimum number of entries to be present in the in-memory Raft log - * for a snapshot to be taken + * Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken. * - * @return long + * @return the minimum number of entries. */ long getSnapshotBatchCount(); /** - * The interval at which a heart beat message will be sent to the remote - * RaftActor + * Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken. * - * @return FiniteDuration + * @return the percentage. */ - FiniteDuration getHeartBeatInterval(); + int getSnapshotDataThresholdPercentage(); /** - * The interval in which a new election would get triggered if no leader is found + * Returns the interval at which a heart beat message should be sent to remote followers. * - * Normally its set to atleast twice the heart beat interval + * @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 FiniteDuration + * @return the interval as a FiniteDuration. */ FiniteDuration getElectionTimeOutInterval(); /** - * 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. * - * @return int + * @return the election time variance. */ int getElectionTimeVariance(); /** - * The size (in bytes) of the snapshot chunk sent from Leader + * Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader. + * + * @return the maximum size (in bytes). */ int getSnapshotChunkSize(); /** - * The number of journal log entries to batch on recovery before applying. + * Returns the maximum number of journal log entries to batch on recovery before applying. + * + * @return the maximum number of journal log entries. */ int getJournalRecoveryLogBatchSize(); /** - * The interval in which the leader needs to check itself if its isolated - * @return FiniteDuration + * 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. */ - FiniteDuration getIsolatedCheckInterval(); + @Nonnull + PeerAddressResolver getPeerAddressResolver(); + + /** + * Returns the custom RaftPolicy class name. + * + * @return the RaftPolicy class name or null if none set. + */ + String getCustomRaftPolicyImplementationClass(); + }