Documentation
¶
Overview ¶
Package watchdog fires when it is not kicked in time. Its timeout event carries the generation of the timer that expired, so Fire itself tells a stale timeout from the current one: the check is in verified code, not in the holder.
Index ¶
Constants ¶
const MaxGen = ^uint64(0)
MaxGen is the last generation. Arming or kicking past it is refused, never wrapped: a wrapped generation could match a timer still in flight.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions uint64
Actions is the set of things the holder must do after a transition, one bit each. The holder performs them in declaration order. The zero value is the empty set.
type Event ¶
Event is an input to Fire. Gen is meaningful for EvTimeout: the generation of the timer that expired.
type EventKind ¶
type EventKind uint8
EventKind says what an event is.
const ( EvArm EventKind EvKick EvTimeout EvStop )
EventKind values.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine is one watchdog. Build it with New and change it only with Fire.
func New ¶
New returns an idle watchdog whose generations continue from start. A holder that restarts passes a start past every generation it handed out before, such as a persisted epoch, so a timer left over from the last run cannot match one from this run.