Documentation ¶
Index ¶
Constants ¶
View Source
const ( Follower = iota Candidate Leader )
Server Roles
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendEntriesArgs ¶
type AppendEntriesArgs struct { LeaderTerm int LeaderID int LeaderCommitIndex int LeaderPrevLogIndex int LeaderPrevLogTerm int LeaderCurEnrtyLog []Log }
AppendEntriesArgs args for Append Entries RPC
type AppendEntriesReply ¶
AppendEntriesReply reply for Append Entries RPC
type ApplyMsg ¶
type ApplyMsg struct { Index int Command interface{} UseSnapshot bool // ignore for Assignment2; only used in Assignment3 Snapshot []byte // ignore for Assignment2; only used in Assignment3 }
ApplyMsg struct for Assignment 3
type Raft ¶
type Raft struct {
// contains filtered or unexported fields
}
Raft struct for Raft Node
func (*Raft) AppendEntries ¶
func (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply)
AppendEntries executes Append Entries RPC on Receiver
func (*Raft) RequestVote ¶
func (rf *Raft) RequestVote(args RequestVoteArgs, reply *RequestVoteReply)
RequestVote executes Request Vote RPC on Receiver
type RequestVoteArgs ¶
type RequestVoteArgs struct { CandidateTerm int CandidateID int CandidateLastLogIndex int CandidateLastLogTerm int }
RequestVoteArgs args for Request Vote RPC
type RequestVoteReply ¶
RequestVoteReply reply for Request Vote RPC
Click to show internal directories.
Click to hide internal directories.