2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.raft;
10 import javax.annotation.Nonnull;
11 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
12 import scala.concurrent.duration.FiniteDuration;
15 * Configuration Parameter interface for configuring the Raft consensus system
17 * Any component using this implementation might want to provide an implementation of
18 * this interface to configure
20 * A default implementation will be used if none is provided.
22 * @author Kamal Rameshan
24 public interface ConfigParams {
26 * Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.
28 * @return the minimum number of entries.
30 long getSnapshotBatchCount();
33 * Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.
35 * @return the percentage.
37 int getSnapshotDataThresholdPercentage();
40 * Returns the interval at which a heart beat message should be sent to remote followers.
42 * @return the interval as a FiniteDuration.
44 FiniteDuration getHeartBeatInterval();
47 * Returns the interval after which a new election should be triggered if no leader is available.
49 * @return the interval as a FiniteDuration.
51 FiniteDuration getElectionTimeOutInterval();
54 * Returns the maximum election time variance. The election is scheduled using both the election timeout and variance.
56 * @return the election time variance.
58 int getElectionTimeVariance();
61 * Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.
63 * @return the maximum size (in bytes).
65 int getSnapshotChunkSize();
68 * Returns the maximum number of journal log entries to batch on recovery before applying.
70 * @return the maximum number of journal log entries.
72 int getJournalRecoveryLogBatchSize();
75 * Returns the interval in which the leader needs to check if its isolated.
77 * @return the interval in ms.
79 long getIsolatedCheckIntervalInMillis();
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.
86 * @return the election timeout factor.
88 long getElectionTimeoutFactor();
92 * Returns the RaftPolicy used to determine certain Raft behaviors.
94 * @return an instance of org.opendaylight.controller.cluster.raft.policy.RaftPolicy, if set, or an instance of the
98 RaftPolicy getRaftPolicy();
101 * Returns the PeerAddressResolver.
103 * @return the PeerAddressResolver instance.
106 PeerAddressResolver getPeerAddressResolver();
109 * Returns the custom RaftPolicy class name.
111 * @return the RaftPolicy class name or null if none set.
113 String getCustomRaftPolicyImplementationClass();