Documentation ¶
Index ¶
- Constants
- type AppendEntriesArgs
- type AppendEntriesReply
- type Cluster
- type LogEntry
- type RaftNode
- func (this *RaftNode) GetNodeState() (id int, term int, isLeader bool)
- func (this *RaftNode) HandleAppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error
- func (this *RaftNode) HandleRequestVote(args RequestVoteArgs, reply *RequestVoteReply) error
- func (this *RaftNode) KillNode()
- func (this *RaftNode) ReceiveClientCommand(command interface{}) bool
- type RequestVoteArgs
- type RequestVoteReply
- type Server
- func (this *Server) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error
- func (this *Server) ConnectToPeer(peerId int, addr net.Addr) error
- func (this *Server) DisconnectAll()
- func (this *Server) DisconnectPeer(peerId int) error
- func (this *Server) GetCurrentAddress() net.Addr
- func (this *Server) RequestVote(args RequestVoteArgs, reply *RequestVoteReply) error
- func (this *Server) SendRPCCallTo(id int, serviceMethod string, args interface{}, reply interface{}) error
- func (this *Server) Serve()
- func (this *Server) Shutdown()
Constants ¶
View Source
const LogHeartbeatMessages = false
View Source
const LogVoteRequestMessages = true
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendEntriesArgs ¶
type AppendEntriesReply ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func (*Cluster) DisconnectPeer ¶
DisconnectPeer disconnects a server from all other servers in the nodes.
func (*Cluster) ReconnectPeer ¶
ReconnectPeer connects a server to all other servers in the nodes.
func (*Cluster) SubmitClientCommand ¶
SubmitClientCommand submits the command to serverId.
type RaftNode ¶
type RaftNode struct { LOG_ENTRIES bool // contains filtered or unexported fields }
Main Raft Data Structure
func NewRaftNode ¶
Constructor for RaftNodes
func (*RaftNode) GetNodeState ¶
GetNodeState reports the state of this RN.
func (*RaftNode) HandleAppendEntries ¶
func (this *RaftNode) HandleAppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error
func (*RaftNode) HandleRequestVote ¶
func (this *RaftNode) HandleRequestVote(args RequestVoteArgs, reply *RequestVoteReply) error
RequestVote RPC. This is the function that is executed by the node that RECEIVES the RequestVote.
func (*RaftNode) KillNode ¶
func (this *RaftNode) KillNode()
Kills a RaftNode and sets its state to Dead
func (*RaftNode) ReceiveClientCommand ¶
Either handle Command or tell to divert it to Leader
type RequestVoteArgs ¶
type RequestVoteArgs struct { Term int CandidateId int LastLogIndex int LastLogTerm int Latency int }
Handles an incoming RPC RequestVote request
type RequestVoteReply ¶
type Server ¶
Server
func (*Server) AppendEntries ¶
func (this *Server) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error
func (*Server) DisconnectAll ¶
func (this *Server) DisconnectAll()
func (*Server) DisconnectPeer ¶
func (*Server) GetCurrentAddress ¶
func (*Server) RequestVote ¶
func (this *Server) RequestVote(args RequestVoteArgs, reply *RequestVoteReply) error
func (*Server) SendRPCCallTo ¶
Click to show internal directories.
Click to hide internal directories.