Merge pull request #4650 from peterbourgon/fix-raft-node-config-docs

Fix raft node config docs
This commit is contained in:
Xiang Li 2016-03-01 07:48:38 -08:00
commit 46a7ef922d

View File

@ -58,54 +58,54 @@ type Config struct {
// ID is the identity of the local raft. ID cannot be 0. // ID is the identity of the local raft. ID cannot be 0.
ID uint64 ID uint64
// peers contains the IDs of all nodes (including self) in // peers contains the IDs of all nodes (including self) in the raft cluster. It
// the raft cluster. It should only be set when starting a new // should only be set when starting a new raft cluster. Restarting raft from
// raft cluster. // previous configuration will panic if peers is set. peer is private and only
// Restarting raft from previous configuration will panic if // used for testing right now.
// peers is set.
// peer is private and only used for testing right now.
peers []uint64 peers []uint64
// ElectionTick is the election timeout. If a follower does not // ElectionTick is the number of Node.Tick invocations that must pass between
// receive any message from the leader of current term during // elections. That is, if a follower does not receive any message from the
// ElectionTick, it will become candidate and start an election. // leader of current term before ElectionTick has elapsed, it will become
// ElectionTick must be greater than HeartbeatTick. We suggest // candidate and start an election. ElectionTick must be greater than
// to use ElectionTick = 10 * HeartbeatTick to avoid unnecessary // HeartbeatTick. We suggest ElectionTick = 10 * HeartbeatTick to avoid
// leader switching. // unnecessary leader switching.
ElectionTick int ElectionTick int
// HeartbeatTick is the heartbeat interval. A leader sends heartbeat // HeartbeatTick is the number of Node.Tick invocations that must pass between
// message to maintain the leadership every heartbeat interval. // heartbeats. That is, a leader sends heartbeat messages to maintain its
// leadership every HeartbeatTick ticks.
HeartbeatTick int HeartbeatTick int
// Storage is the storage for raft. raft generates entries and // Storage is the storage for raft. raft generates entries and states to be
// states to be stored in storage. raft reads the persisted entries // stored in storage. raft reads the persisted entries and states out of
// and states out of Storage when it needs. raft reads out the previous // Storage when it needs. raft reads out the previous state and configuration
// state and configuration out of storage when restarting. // out of storage when restarting.
Storage Storage Storage Storage
// Applied is the last applied index. It should only be set when restarting // Applied is the last applied index. It should only be set when restarting
// raft. raft will not return entries to the application smaller or equal to Applied. // raft. raft will not return entries to the application smaller or equal to
// If Applied is unset when restarting, raft might return previous applied entries. // Applied. If Applied is unset when restarting, raft might return previous
// This is a very application dependent configuration. // applied entries. This is a very application dependent configuration.
Applied uint64 Applied uint64
// MaxSizePerMsg limits the max size of each append message. Smaller value lowers // MaxSizePerMsg limits the max size of each append message. Smaller value
// the raft recovery cost(initial probing and message lost during normal operation). // lowers the raft recovery cost(initial probing and message lost during normal
// On the other side, it might affect the throughput during normal replication. // operation). On the other side, it might affect the throughput during normal
// Note: math.MaxUint64 for unlimited, 0 for at most one entry per message. // replication. Note: math.MaxUint64 for unlimited, 0 for at most one entry per
// message.
MaxSizePerMsg uint64 MaxSizePerMsg uint64
// MaxInflightMsgs limits the max number of in-flight append messages during optimistic // MaxInflightMsgs limits the max number of in-flight append messages during
// replication phase. The application transportation layer usually has its own sending // optimistic replication phase. The application transportation layer usually
// buffer over TCP/UDP. Setting MaxInflightMsgs to avoid overflowing that sending buffer. // has its own sending buffer over TCP/UDP. Setting MaxInflightMsgs to avoid
// TODO (xiangli): feedback to application to limit the proposal rate? // overflowing that sending buffer. TODO (xiangli): feedback to application to
// limit the proposal rate?
MaxInflightMsgs int MaxInflightMsgs int
// CheckQuorum specifies if the leader should check quorum activity. Leader steps down when // CheckQuorum specifies if the leader should check quorum activity. Leader
// quorum is not active for an electionTimeout. // steps down when quorum is not active for an electionTimeout.
CheckQuorum bool CheckQuorum bool
// Logger is the logger used for raft log. For multinode which // Logger is the logger used for raft log. For multinode which can host
// can host multiple raft group, each raft group can have its // multiple raft group, each raft group can have its own logger
// own logger
Logger Logger Logger Logger
} }