Versions in this module Expand all Collapse all v1 v1.0.5 Jan 18, 2019 Changes in this version + func MockSetMysqlHandler(raft *Raft, h mysql.MysqlHandler) v1.0.4 Jan 2, 2019 v1.0.3 Dec 23, 2018 v1.0.2 Dec 23, 2018 v1.0.1 Sep 12, 2018 Changes in this version + const MsgNone + const MsgRaftHeartbeat + const MsgRaftRequestVote + func MockGetClient(t *testing.T, svrConn string) (*xrpc.Client, func()) + func MockSetReplHandler(raft *Raft, h mysql.ReplHandler) + func MockStateTransition(raft *Raft, state State) + func MockWaitLeaderEggs(rafts []*Raft, leadernums int) int + func MockWaitMySQLPingTimeout() + type Candidate struct + func NewCandidate(r *Raft) *Candidate + func (r *Candidate) Loop() + type Follower struct + ChangeToMasterError bool + func NewFollower(r *Raft) *Follower + func (r *Follower) Loop() + type HARPC struct + func (h *HARPC) HADisable(req *model.HARPCRequest, rsp *model.HARPCResponse) error + func (h *HARPC) HAEnable(req *model.HARPCRequest, rsp *model.HARPCResponse) error + func (h *HARPC) HATryToLeader(req *model.HARPCRequest, rsp *model.HARPCResponse) error + type Idle struct + func NewIdle(r *Raft) *Idle + func (r *Idle) Loop() + type Leader struct + func NewLeader(r *Raft) *Leader + func (r *Leader) Loop() + type Peer struct + func NewPeer(raft *Raft, connectionStr string, requestTimeout int, heartbeatTimeout int) *Peer + func (p *Peer) NewClient() (*xrpc.Client, func(), error) + type Raft struct + C *Candidate + F *Follower + I *Idle + L *Leader + func MockRafts(log *xlog.Log, port int, count int) ([]string, []*Raft, func()) + func MockRaftsWithConfig(log *xlog.Log, conf *config.RaftConfig, port int, count int) ([]string, []*Raft, func()) + func MockRaftsWithLong(log *xlog.Log, port int, count int) ([]string, []*Raft, func()) + func NewRaft(id string, conf *config.RaftConfig, log *xlog.Log, mysql *mysql.Mysql) *Raft + func (r *Raft) AddPeer(connStr string) error + func (r *Raft) DEBUG(format string, v ...interface{}) + func (r *Raft) ERROR(format string, v ...interface{}) + func (r *Raft) GetEpochID() uint64 + func (r *Raft) GetLeader() string + func (r *Raft) GetMembers() int + func (r *Raft) GetPeers() []string + func (r *Raft) GetQuorums() int + func (r *Raft) GetRaftRPC() *RaftRPC + func (r *Raft) GetState() State + func (r *Raft) GetVewiID() uint64 + func (r *Raft) INFO(format string, v ...interface{}) + func (r *Raft) PANIC(format string, v ...interface{}) + func (r *Raft) RemovePeer(connStr string) error + func (r *Raft) SetSkipPurgeBinlog(v bool) + func (r *Raft) Start() error + func (r *Raft) Stop() error + func (r *Raft) WARNING(format string, v ...interface{}) + func (s *Raft) GetHARPC() *HARPC + func (s *Raft) IncCandidateDegrades() + func (s *Raft) IncCandidatePromotes() + func (s *Raft) IncLeaderDegrades() + func (s *Raft) IncLeaderGetHeartbeatRequests() + func (s *Raft) IncLeaderGetVoteRequests() + func (s *Raft) IncLeaderPromotes() + func (s *Raft) IncLeaderPurgeBinlogFails() + func (s *Raft) IncLeaderPurgeBinlogs() + func (s *Raft) IncLessHeartbeatAcks() + func (s *Raft) ResetRaftMysqlStatus() + func (s *Raft) SetRaftMysqlStatus(rms model.RAFTMYSQL_STATUS) + type RaftMeta struct + EpochID uint64 + Peers []string + ViewID uint64 + type RaftRPC struct + func (r *RaftRPC) DisablePurgeBinlog(req *model.RaftStatusRPCRequest, rsp *model.RaftStatusRPCResponse) error + func (r *RaftRPC) EnablePurgeBinlog(req *model.RaftStatusRPCRequest, rsp *model.RaftStatusRPCResponse) error + func (r *RaftRPC) Heartbeat(req *model.RaftRPCRequest, rsp *model.RaftRPCResponse) error + func (r *RaftRPC) RequestVote(req *model.RaftRPCRequest, rsp *model.RaftRPCResponse) error + func (r *RaftRPC) Status(req *model.RaftStatusRPCRequest, rsp *model.RaftStatusRPCResponse) error + type State int + const CANDIDATE + const FOLLOWER + const IDLE + const LEADER + const STOPPED + func (s State) String() string