BUG 2187 - Creating ShardReplica
[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      * The minimum number of entries to be present in the in-memory Raft log
27      * for a snapshot to be taken
28      *
29      * @return long
30      */
31     long getSnapshotBatchCount();
32
33     /**
34      * The percentage of total memory in the in-memory Raft log before a snapshot
35      * is to be taken
36      *
37      * @return int
38      */
39     int getSnapshotDataThresholdPercentage();
40
41     /**
42      * The interval at which a heart beat message will be sent to the remote
43      * RaftActor
44      *
45      * @return FiniteDuration
46      */
47     FiniteDuration getHeartBeatInterval();
48
49     /**
50      * The interval in which a new election would get triggered if no leader is found
51      *
52      * Normally its set to atleast twice the heart beat interval
53      *
54      * @return FiniteDuration
55      */
56     FiniteDuration getElectionTimeOutInterval();
57
58     /**
59      * The maximum election time variance. The election is scheduled using both
60      * the Election Timeout and Variance
61      *
62      * @return int
63      */
64     int getElectionTimeVariance();
65
66     /**
67      * The size (in bytes) of the snapshot chunk sent from Leader
68      */
69     int getSnapshotChunkSize();
70
71     /**
72      * The number of journal log entries to batch on recovery before applying.
73      */
74     int getJournalRecoveryLogBatchSize();
75
76     /**
77      * The interval in which the leader needs to check itself if its isolated
78      * @return FiniteDuration
79      */
80     long getIsolatedCheckIntervalInMillis();
81
82
83     /**
84      * The multiplication factor to be used to determine shard election timeout. The election timeout
85      * is determined by multiplying the election timeout factor with the heartbeat duration.
86      */
87     long getElectionTimeoutFactor();
88
89
90     /**
91      *
92      * @return An instance of org.opendaylight.controller.cluster.raft.policy.RaftPolicy or an instance of the
93      * DefaultRaftPolicy
94      */
95     RaftPolicy getRaftPolicy();
96
97     /**
98      * Returns the PeerAddressResolver.
99      */
100     @Nonnull PeerAddressResolver getPeerAddressResolver();
101
102     /**
103      * @return the RaftPolicy class used by this configuration
104      */
105     String getCustomRaftPolicyImplementationClass();
106
107 }