Documentation
¶
Index ¶
- type AppendRPCRequest
- type AppendRPCResponse
- type ClientPool
- type ClientResponse
- type RaftApi
- type RaftService
- func (rs *RaftService) Get(cmd *entity.Command, resp *ClientResponse) error
- func (rs *RaftService) OnReceiveAppendRPC(req *AppendRPCRequest, resp *AppendRPCResponse) error
- func (rs *RaftService) OnReceiveRequestVoteRPC(req *RequestVoteRequest, resp *RequestVoteResponse) error
- func (rs *RaftService) Set(cmd *entity.Command, resp *ClientResponse) error
- type RequestVoteRequest
- type RequestVoteResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendRPCRequest ¶
type AppendRPCRequest struct {
// leaderId
LeaderNode *core.ServerInfo
// log entries to store (empty for heartbeat; may send more than one for efficiency)
LogEntries []*core.LogEntry
// leader’s term
Term int
// term of prevLogIndex entry
PrevLogTerm int
// index of log entry immediately preceding new ones
PrevLogIndex int
// leader’s commitIndex
CommitIndex int
}
type AppendRPCResponse ¶
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
func NewClientPool ¶
func NewClientPool() *ClientPool
type ClientResponse ¶
type RaftApi ¶
type RaftApi interface {
Get(cmd *entity.Command, resp *ClientResponse) error
Set(cmd *entity.Command, resp *ClientResponse) error
OnReceiveAppendRPC(req *AppendRPCRequest, resp *AppendRPCResponse) error
OnReceiveRequestVoteRPC(req *RequestVoteRequest, resp *RequestVoteResponse) error
}
type RaftService ¶
type RaftService struct {
// contains filtered or unexported fields
}
func NewRaftService ¶
func NewRaftService(server RaftApi) *RaftService
func (*RaftService) Get ¶
func (rs *RaftService) Get(cmd *entity.Command, resp *ClientResponse) error
func (*RaftService) OnReceiveAppendRPC ¶
func (rs *RaftService) OnReceiveAppendRPC(req *AppendRPCRequest, resp *AppendRPCResponse) error
func (*RaftService) OnReceiveRequestVoteRPC ¶
func (rs *RaftService) OnReceiveRequestVoteRPC(req *RequestVoteRequest, resp *RequestVoteResponse) error
func (*RaftService) Set ¶
func (rs *RaftService) Set(cmd *entity.Command, resp *ClientResponse) error
type RequestVoteRequest ¶
type RequestVoteRequest struct {
// term of candidate’s last log entry
LastLogTerm int
// index of candidate’s last log entry
LastLogIndex int
// candidate’s term
NextTerm int
// candidate requesting vote
Candidate *core.ServerInfo
}
type RequestVoteResponse ¶
Click to show internal directories.
Click to hide internal directories.