Package io.microraft
Class RaftConfig
- java.lang.Object
-
- io.microraft.RaftConfig
-
- All Implemented Interfaces:
Serializable
public final class RaftConfig extends Object implements Serializable
Contains the configuration parameters for MicroRaft's implementation.RaftConfig is an immutable configuration class. You can use a RaftConfigBuilder to build a RaftConfig object.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRaftConfig.RaftConfigBuilderBuilder for Raft config
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_APPEND_ENTRIES_REQUEST_BATCH_SIZEThe default value forappendEntriesRequestBatchSize.static intDEFAULT_COMMIT_COUNT_TO_TAKE_SNAPSHOTThe default value forcommitCountToTakeSnapshot.static longDEFAULT_LEADER_ELECTION_TIMEOUT_MILLISThe default value forleaderElectionTimeoutMillis.static longDEFAULT_LEADER_HEARTBEAT_PERIOD_SECSThe default value forleaderHeartbeatPeriodSecs.static longDEFAULT_LEADER_HEARTBEAT_TIMEOUT_SECSThe default value forleaderHeartbeatTimeoutSecsstatic intDEFAULT_MAX_PENDING_LOG_ENTRY_COUNTThe default value formaxPendingLogEntryCount.static RaftConfigDEFAULT_RAFT_CONFIGThe config object with default configuration.static intDEFAULT_RAFT_NODE_REPORT_PUBLISH_PERIOD_SECSThe default value forraftNodeReportPublishPeriodSecs.static booleanDEFAULT_TRANSFER_SNAPSHOTS_FROM_FOLLOWERS_ENABLEDThe default value fortransferSnapshotsFromFollowersEnabled
-
Constructor Summary
Constructors Constructor Description RaftConfig(long leaderElectionTimeoutMillis, long leaderHeartbeatPeriodSecs, long leaderHeartbeatTimeoutSecs, int appendEntriesRequestBatchSize, int commitCountToTakeSnapshot, int maxPendingLogEntryCount, boolean transferSnapshotsFromFollowersEnabled, int raftNodeReportPublishPeriodSecs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAppendEntriesRequestBatchSize()intgetCommitCountToTakeSnapshot()longgetLeaderElectionTimeoutMillis()longgetLeaderHeartbeatPeriodSecs()longgetLeaderHeartbeatTimeoutSecs()intgetMaxPendingLogEntryCount()intgetRaftNodeReportPublishPeriodSecs()booleanisTransferSnapshotsFromFollowersEnabled()static RaftConfig.RaftConfigBuildernewBuilder()Creates a new Raft config builder.StringtoString()
-
-
-
Field Detail
-
DEFAULT_LEADER_ELECTION_TIMEOUT_MILLIS
public static final long DEFAULT_LEADER_ELECTION_TIMEOUT_MILLIS
The default value forleaderElectionTimeoutMillis.- See Also:
- Constant Field Values
-
DEFAULT_LEADER_HEARTBEAT_TIMEOUT_SECS
public static final long DEFAULT_LEADER_HEARTBEAT_TIMEOUT_SECS
The default value forleaderHeartbeatTimeoutSecs- See Also:
- Constant Field Values
-
DEFAULT_LEADER_HEARTBEAT_PERIOD_SECS
public static final long DEFAULT_LEADER_HEARTBEAT_PERIOD_SECS
The default value forleaderHeartbeatPeriodSecs.- See Also:
- Constant Field Values
-
DEFAULT_MAX_PENDING_LOG_ENTRY_COUNT
public static final int DEFAULT_MAX_PENDING_LOG_ENTRY_COUNT
The default value formaxPendingLogEntryCount.- See Also:
- Constant Field Values
-
DEFAULT_APPEND_ENTRIES_REQUEST_BATCH_SIZE
public static final int DEFAULT_APPEND_ENTRIES_REQUEST_BATCH_SIZE
The default value forappendEntriesRequestBatchSize.- See Also:
- Constant Field Values
-
DEFAULT_COMMIT_COUNT_TO_TAKE_SNAPSHOT
public static final int DEFAULT_COMMIT_COUNT_TO_TAKE_SNAPSHOT
The default value forcommitCountToTakeSnapshot.- See Also:
- Constant Field Values
-
DEFAULT_TRANSFER_SNAPSHOTS_FROM_FOLLOWERS_ENABLED
public static final boolean DEFAULT_TRANSFER_SNAPSHOTS_FROM_FOLLOWERS_ENABLED
The default value fortransferSnapshotsFromFollowersEnabled- See Also:
- Constant Field Values
-
DEFAULT_RAFT_NODE_REPORT_PUBLISH_PERIOD_SECS
public static final int DEFAULT_RAFT_NODE_REPORT_PUBLISH_PERIOD_SECS
The default value forraftNodeReportPublishPeriodSecs.- See Also:
- Constant Field Values
-
DEFAULT_RAFT_CONFIG
public static final RaftConfig DEFAULT_RAFT_CONFIG
The config object with default configuration.
-
-
Constructor Detail
-
RaftConfig
public RaftConfig(long leaderElectionTimeoutMillis, long leaderHeartbeatPeriodSecs, long leaderHeartbeatTimeoutSecs, int appendEntriesRequestBatchSize, int commitCountToTakeSnapshot, int maxPendingLogEntryCount, boolean transferSnapshotsFromFollowersEnabled, int raftNodeReportPublishPeriodSecs)
-
-
Method Detail
-
newBuilder
public static RaftConfig.RaftConfigBuilder newBuilder()
Creates a new Raft config builder.- Returns:
- the builder to populate the parameters for RaftConfig.
-
getLeaderElectionTimeoutMillis
public long getLeaderElectionTimeoutMillis()
- Returns:
- the leader election timeout in milliseconds
- See Also:
leaderElectionTimeoutMillis
-
getLeaderHeartbeatTimeoutSecs
public long getLeaderHeartbeatTimeoutSecs()
- Returns:
- leader heartbeat timeout seconds
- See Also:
leaderHeartbeatTimeoutSecs
-
getLeaderHeartbeatPeriodSecs
public long getLeaderHeartbeatPeriodSecs()
- Returns:
- the leader election heartbeat period in seconds
- See Also:
leaderHeartbeatPeriodSecs
-
getMaxPendingLogEntryCount
public int getMaxPendingLogEntryCount()
- Returns:
- the max pending log entry count
- See Also:
maxPendingLogEntryCount
-
getAppendEntriesRequestBatchSize
public int getAppendEntriesRequestBatchSize()
- Returns:
- the append entries request batch size
- See Also:
appendEntriesRequestBatchSize
-
getCommitCountToTakeSnapshot
public int getCommitCountToTakeSnapshot()
- Returns:
- the commit count to take snapshot
- See Also:
commitCountToTakeSnapshot
-
isTransferSnapshotsFromFollowersEnabled
public boolean isTransferSnapshotsFromFollowersEnabled()
- Returns:
- true if the transfer snapshots from followers enabled
- See Also:
transferSnapshotsFromFollowersEnabled
-
getRaftNodeReportPublishPeriodSecs
public int getRaftNodeReportPublishPeriodSecs()
- Returns:
- the raft node report publish period in seconds
- See Also:
raftNodeReportPublishPeriodSecs
-
-