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 ¶
type CmdAddWatcher struct {
HbID string
Nodename string
Desc string
Ctx context.Context
Timeout time.Duration
}
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 CmdEvent ¶
type CmdEvent struct {
Name string
Nodename string
HbID string
// contains filtered or unexported fields
}
CmdEvent is a command to post new hb event
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 CmdSetAlert ¶
type CmdSetAlert struct {
HbID string
Alert []daemonsubsystem.Alert
}
CmdSetAlert is a command to post new hb alert
type CmdSetDesc ¶
CmdSetDesc is a command to set the description of the peer of a hb stream, as the slot a disk stream writes or reads, which the stream knows once claimed or read, after it added its watchers.
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 DecodeErrors ¶
type DecodeErrors struct {
// contains filtered or unexported fields
}
DecodeErrors logs the heartbeat messages of a peer this agent can not decode, once per peer and error rather than once per message.
A peer whose message decrypts is alive, whatever its message holds, and is counted so: a message this agent can not decode is one from a peer running another version, and finding that peer dead would have this node take over what it runs. Its data is not applied, which is what the log says, once, and again when it decodes again.
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