kubernetes/vendor/go.etcd.io/etcd/raft/v3/raft.go

const None

const noLimit

const StateFollower

const StateCandidate

const StateLeader

const StatePreCandidate

const numStates

type ReadOnlyOption

const ReadOnlySafe

const ReadOnlyLeaseBased

const campaignPreElection

const campaignElection

const campaignTransfer

var ErrProposalDropped

type lockedRand

func (r *lockedRand) Intn(n int) int {}

var globalRand

type CampaignType

type StateType

var stmap

func (st StateType) String() string {}

type Config

func (c *Config) validate() error {}

type raft

func newRaft(c *Config) *raft {}

func (r *raft) hasLeader() bool {}

func (r *raft) softState() *SoftState {}

func (r *raft) hardState() pb.HardState {}

// send schedules persisting state to a stable storage and AFTER that
// sending the message (as part of next Ready message processing).
func (r *raft) send(m pb.Message) {}

// sendAppend sends an append RPC with new entries (if any) and the
// current commit index to the given peer.
func (r *raft) sendAppend(to uint64) {}

// maybeSendAppend sends an append RPC with new entries to the given peer,
// if necessary. Returns true if a message was sent. The sendIfEmpty
// argument controls whether messages with no entries will be sent
// ("empty" messages are useful to convey updated Commit indexes, but
// are undesirable when we're sending multiple messages in a batch).
func (r *raft) maybeSendAppend(to uint64, sendIfEmpty bool) bool {}

// sendHeartbeat sends a heartbeat RPC to the given peer.
func (r *raft) sendHeartbeat(to uint64, ctx []byte) {}

// bcastAppend sends RPC, with entries to all peers that are not up-to-date
// according to the progress recorded in r.prs.
func (r *raft) bcastAppend() {}

// bcastHeartbeat sends RPC, without entries to all the peers.
func (r *raft) bcastHeartbeat() {}

func (r *raft) bcastHeartbeatWithCtx(ctx []byte) {}

func (r *raft) advance(rd Ready) {}

// maybeCommit attempts to advance the commit index. Returns true if
// the commit index changed (in which case the caller should call
// r.bcastAppend).
func (r *raft) maybeCommit() bool {}

func (r *raft) reset(term uint64) {}

func (r *raft) appendEntry(es ...pb.Entry) (accepted bool) {}

// tickElection is run by followers and candidates after r.electionTimeout.
func (r *raft) tickElection() {}

// tickHeartbeat is run by leaders to send a MsgBeat after r.heartbeatTimeout.
func (r *raft) tickHeartbeat() {}

func (r *raft) becomeFollower(term uint64, lead uint64) {}

func (r *raft) becomeCandidate() {}

func (r *raft) becomePreCandidate() {}

func (r *raft) becomeLeader() {}

func (r *raft) hup(t CampaignType) {}

// campaign transitions the raft instance to candidate state. This must only be
// called after verifying that this is a legitimate transition.
func (r *raft) campaign(t CampaignType) {}

func (r *raft) poll(id uint64, t pb.MessageType, v bool) (granted int, rejected int, result quorum.VoteResult) {}

func (r *raft) Step(m pb.Message) error {}

type stepFunc

func stepLeader(r *raft, m pb.Message) error {}

// stepCandidate is shared by StateCandidate and StatePreCandidate; the difference is
// whether they respond to MsgVoteResp or MsgPreVoteResp.
func stepCandidate(r *raft, m pb.Message) error {}

func stepFollower(r *raft, m pb.Message) error {}

func (r *raft) handleAppendEntries(m pb.Message) {}

func (r *raft) handleHeartbeat(m pb.Message) {}

func (r *raft) handleSnapshot(m pb.Message) {}

// restore recovers the state machine from a snapshot. It restores the log and the
// configuration of state machine. If this method returns false, the snapshot was
// ignored, either because it was obsolete or because of an error.
func (r *raft) restore(s pb.Snapshot) bool {}

// promotable indicates whether state machine can be promoted to leader,
// which is true when its own id is in progress list.
func (r *raft) promotable() bool {}

func (r *raft) applyConfChange(cc pb.ConfChangeV2) pb.ConfState {}

// switchToConfig reconfigures this node to use the provided configuration. It
// updates the in-memory state and, when necessary, carries out additional
// actions such as reacting to the removal of nodes or changed quorum
// requirements.
//
// The inputs usually result from restoring a ConfState or applying a ConfChange.
func (r *raft) switchToConfig(cfg tracker.Config, prs tracker.ProgressMap) pb.ConfState {}

func (r *raft) loadState(state pb.HardState) {}

// pastElectionTimeout returns true iff r.electionElapsed is greater
// than or equal to the randomized election timeout in
// [electiontimeout, 2 * electiontimeout - 1].
func (r *raft) pastElectionTimeout() bool {}

func (r *raft) resetRandomizedElectionTimeout() {}

func (r *raft) sendTimeoutNow(to uint64) {}

func (r *raft) abortLeaderTransfer() {}

// committedEntryInCurrentTerm return true if the peer has committed an entry in its term.
func (r *raft) committedEntryInCurrentTerm() bool {}

// responseToReadIndexReq constructs a response for `req`. If `req` comes from the peer
// itself, a blank value will be returned.
func (r *raft) responseToReadIndexReq(req pb.Message, readIndex uint64) pb.Message {}

// increaseUncommittedSize computes the size of the proposed entries and
// determines whether they would push leader over its maxUncommittedSize limit.
// If the new entries would exceed the limit, the method returns false. If not,
// the increase in uncommitted entry size is recorded and the method returns
// true.
//
// Empty payloads are never refused. This is used both for appending an empty
// entry at a new leader's term, as well as leaving a joint configuration.
func (r *raft) increaseUncommittedSize(ents []pb.Entry) bool {}

// reduceUncommittedSize accounts for the newly committed entries by decreasing
// the uncommitted entry size limit.
func (r *raft) reduceUncommittedSize(ents []pb.Entry) {}

func numOfPendingConf(ents []pb.Entry) int {}

func releasePendingReadIndexMessages(r *raft) {}

func sendMsgReadIndexResponse(r *raft, m pb.Message) {}