Fix warnings and javadocs in sal-akka-raft
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / ConfigParams.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft;
9
10 import javax.annotation.Nonnull;
11 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
12 import scala.concurrent.duration.FiniteDuration;
13
14 /**
15  * Configuration Parameter interface for configuring the Raft consensus system
16  * <p/>
17  * Any component using this implementation might want to provide an implementation of
18  * this interface to configure
19  *
20  * A default implementation will be used if none is provided.
21  *
22  * @author Kamal Rameshan
23  */
24 public interface ConfigParams {
25     /**
26      * Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.
27      *
28      * @return the minimum number of entries.
29      */
30     long getSnapshotBatchCount();
31
32     /**
33      * Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.
34      *
35      * @return the percentage.
36      */
37     int getSnapshotDataThresholdPercentage();
38
39     /**
40      * Returns the interval at which a heart beat message should be sent to remote followers.
41      *
42      * @return the interval as a FiniteDuration.
43      */
44     FiniteDuration getHeartBeatInterval();
45
46     /**
47      * Returns the interval after which a new election should be triggered if no leader is available.
48      *
49      * @return the interval as a FiniteDuration.
50      */
51     FiniteDuration getElectionTimeOutInterval();
52
53     /**
54      * Returns the maximum election time variance. The election is scheduled using both the election timeout and variance.
55      *
56      * @return the election time variance.
57      */
58     int getElectionTimeVariance();
59
60     /**
61      * Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.
62      *
63      * @return the maximum size (in bytes).
64      */
65     int getSnapshotChunkSize();
66
67     /**
68      * Returns the maximum number of journal log entries to batch on recovery before applying.
69      *
70      * @return the maximum number of journal log entries.
71      */
72     int getJournalRecoveryLogBatchSize();
73
74     /**
75      * Returns the interval in which the leader needs to check if its isolated.
76      *
77      * @return the interval in ms.
78      */
79     long getIsolatedCheckIntervalInMillis();
80
81
82     /**
83      * Returns the multiplication factor to be used to determine the shard election timeout. The election timeout
84      * is determined by multiplying the election timeout factor with the heart beat duration.
85      *
86      * @return the election timeout factor.
87      */
88     long getElectionTimeoutFactor();
89
90
91     /**
92      * Returns the RaftPolicy used to determine certain Raft behaviors.
93      *
94      * @return an instance of org.opendaylight.controller.cluster.raft.policy.RaftPolicy, if set,  or an instance of the
95      * DefaultRaftPolicy.
96      */
97     @Nonnull
98     RaftPolicy getRaftPolicy();
99
100     /**
101      * Returns the PeerAddressResolver.
102      *
103      * @return the PeerAddressResolver instance.
104      */
105     @Nonnull
106     PeerAddressResolver getPeerAddressResolver();
107
108     /**
109      * Returns the custom RaftPolicy class name.
110      *
111      * @return the RaftPolicy class name or null if none set.
112      */
113     String getCustomRaftPolicyImplementationClass();
114
115 }