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 * The minimum number of entries to be present in the in-memory Raft log
27 * for a snapshot to be taken
31 long getSnapshotBatchCount();
34 * The percentage of total memory in the in-memory Raft log before a snapshot
39 int getSnapshotDataThresholdPercentage();
42 * The interval at which a heart beat message will be sent to the remote
45 * @return FiniteDuration
47 FiniteDuration getHeartBeatInterval();
50 * The interval in which a new election would get triggered if no leader is found
52 * Normally its set to atleast twice the heart beat interval
54 * @return FiniteDuration
56 FiniteDuration getElectionTimeOutInterval();
59 * The maximum election time variance. The election is scheduled using both
60 * the Election Timeout and Variance
64 int getElectionTimeVariance();
67 * The size (in bytes) of the snapshot chunk sent from Leader
69 int getSnapshotChunkSize();
72 * The number of journal log entries to batch on recovery before applying.
74 int getJournalRecoveryLogBatchSize();
77 * The interval in which the leader needs to check itself if its isolated
78 * @return FiniteDuration
80 long getIsolatedCheckIntervalInMillis();
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.
87 long getElectionTimeoutFactor();
92 * @return An instance of org.opendaylight.controller.cluster.raft.policy.RaftPolicy or an instance of the
95 RaftPolicy getRaftPolicy();
98 * Returns the PeerAddressResolver.
100 @Nonnull PeerAddressResolver getPeerAddressResolver();
103 * @return the RaftPolicy class used by this configuration
105 String getCustomRaftPolicyImplementationClass();