Documentation ¶
Index ¶
- Constants
- Variables
- func Add(key, value []byte)
- func AddHeartTask(params string)
- func BuildHash(key []byte) *utils.Multihash
- func Del(key []byte)
- func DelTeam(teamid *utils.Multihash) error
- func DoVote(teamid, nodeid *utils.Multihash)
- func GetRole(teamid, nodeid *utils.Multihash) string
- func Init()
- func MulitiHeart(team *RaftTeam)
- func MulitiVote(rt *RaftTeam)
- func RaftVote(c engine.Controller, msg engine.Packet)
- func RaftVoteHeart(c engine.Controller, msg engine.Packet)
- func RaftVoteHeart_recv(c engine.Controller, msg engine.Packet)
- func RaftVote_recv(c engine.Controller, msg engine.Packet)
- func RandInt64(min, max int) string
- func Register()
- func RegisterRaft()
- func SaveTeam(team *RaftTeam) error
- func Update(key, value []byte)
- func UpdateHeartTime(teamid *utils.Multihash) error
- type HeartData
- type RaftData
- type RaftRole
- type RaftTeam
Constants ¶
View Source
const ( MSGID_RaftVote = 3001 //投票同步 MSGID_RaftVote_recv = 3002 //投票同步 返回 MSGID_RaftVoteHeart = 3003 //心跳同步 MSGID_RaftVoteHeart_recv = 3004 //心跳同步 返回 )
View Source
const ( Leader = "leader" //管理者 Follower = "follower" //追随者 Candidate = "candidate" //候选者 )
View Source
const (
Task_class_raft_heart = "Task_class_raft_heart" //定时发送心跳信息
)
Variables ¶
View Source
var ( HeartInterval = 15 //心跳间隔,超过时间没收到,则视为断开 HeartTime = make(map[string]time.Time) //心跳时间,key为team leader HeartMin = 1500 //心跳检查间隔最小值 ms HeartMax = 3000 //心跳检查最大值 ms )
View Source
var (
TimeInterval = 5 //心跳间隔,单位秒
)
View Source
var (
Version = uint64(0x00)
)
Functions ¶
func RaftVoteHeart ¶
func RaftVoteHeart(c engine.Controller, msg engine.Packet)
func RaftVote_recv ¶
func RaftVote_recv(c engine.Controller, msg engine.Packet)
func RegisterRaft ¶
func RegisterRaft()
Types ¶
type RaftData ¶
var (
RD *RaftData
)
func NewRaftData ¶
func NewRaftData() *RaftData
func (*RaftData) CreateTeam ¶
创建team
Click to show internal directories.
Click to hide internal directories.