Documentation ¶
Overview ¶
node相关的mqtt处理
node 已知的节点上线
Index ¶
- func DistributeID(id int, addr string, port int)
- func FindNodeMysql(id int) (node db.Node, err error)
- func FindNodeRds(id int) (addr string, port string, err error)
- func FormatPayloadOldNode(payload *[]byte) (*db.Node, error)
- func HeartbeatHandler(client mq.Client, msg mq.Message)
- func InsertHeartBeatRedis(hbData *HeartBeat) error
- func InsertNodeMysql(addr string, port int) (int, error)
- func InsertNodeRedis(node *db.Node) error
- func ListenNode()
- func NewNodeonHandler(client mq.Client, msg mq.Message)
- func NodeOnCheck(node *db.Node) (bool, error)
- func NodeOnConfirm(node *db.Node)
- func OldNodeonHandler(client mq.Client, msg mq.Message)
- func UpdateNodeMysql(node *db.Node) error
- type HeartBeat
- type NewNodeOn
- type OldNodeOn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindNodeMysql ¶
根据node的id,在MySQL中获取该node的地址、端口信息
func FindNodeRds ¶
根据node的id,在Redis获取该node的地址、端口信息
func FormatPayloadOldNode ¶
格式化mqtt传入数据-旧节点
func InsertHeartBeatRedis ¶
func InsertNodeMysql ¶
将node的单个数据写入MySQL,返回此node的id (未来优化性能入手点之一)
Types ¶
type HeartBeat ¶
type HeartBeat struct { ID int `json:"id"` CPU int `json:"cpu"` Mem int `json:"mem"` Disk int `json:"disk"` }
func FormatPayloadHeartbeat ¶
Click to show internal directories.
Click to hide internal directories.