Package io.microraft

Class 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
    • 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