Documentation ¶
Overview ¶
Package hbctrl manage data and status of daemon heartbeats
It maintains the local node heartbeats status cache, this cache is published to daemondata on a ticker interval
Example:
c := New() c.Start(context.Background()) // from another hb#2.tx routine // Add a watchers for hb#2.rx nodes node2 and node3 // watchers are responsible for firing hb_stale/hb_beating event to // controller for hbID + remote nodename cmdC <- hbctrl.CmdAddWatcher{ HbID: "hb#2.tx", Nodename: "node2", Ctx: ctx, Timeout: r.timeout, } cmdC <- hbctrl.CmdAddWatcher{ HbID: "hb#2.tx", Nodename: "node3", Ctx: ctx, Timeout: r.timeout, } //set the success status of node2 c.cmdC() <- hbctrl.CmdSetPeerSuccess{ Nodename: "node2", HbID: "hb#2.tx", Success: true, }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C ¶
type C struct {
// contains filtered or unexported fields
}
C struct holds the hb controller data
func (*C) Start ¶
Start starts hb controller goroutine, it returns its cmd chan
The hb controller is responsible if the heartbeat data cache from: - register/unregister heartbeat tx or rx - addWatcher/delWatcher of a hb peer - setPeerSuccess
The cache is sent to daemondata on regular time interval ¶
The controller will die when ctx is done
type CmdAddWatcher ¶
CmdAddWatcher is a command to run new instance of a hb watcher for a remote
type CmdDelWatcher ¶
CmdDelWatcher is a command to stop one instance of a hb watcher for a remote
type CmdGetEventStats ¶
type CmdGetEventStats struct {
// contains filtered or unexported fields
}
CmdGetEventStats is a getter of ctrl event counters
type CmdRegister ¶
type CmdRegister struct { ID string // the new hb id (example: hb#1.tx) // Type is the hb type Type string }
CmdRegister is the command to register a new heartbeat status
type CmdSetPeerStatus ¶
type CmdSetPeerStatus struct { Nodename string HbID string PeerStatus daemonsubsystem.HeartbeatStreamPeerStatus }
CmdSetPeerStatus is a command to set a hb peer HeartbeatPeerStatus for a node
type CmdSetPeerSuccess ¶
CmdSetPeerSuccess is a command to set a hb peer success value for a node
type CmdSetState ¶
CmdSetState is the command to update a heartbeat status state
type CmdUnregister ¶
type CmdUnregister struct {
ID string // the hb id to remove (example: hb#1.tx)
}
CmdUnregister is the command to unregister a heartbeat status
type GetPeerStatus ¶
type GetPeerStatus struct { HbID string // contains filtered or unexported fields }
GetPeerStatus is command to retrieve remote peer status for a hb
type RemoteBeating ¶
type RemoteBeating struct {
// contains filtered or unexported fields
}
RemoteBeating holds Remote beating stats for a remote node