Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorFunc ¶
type ErrorFunc func(error)
ErrorFunc is a function that will be called by Nanny if there was any error during notifier.Notify call.
type Nanny ¶
type Nanny struct { Name string // Nanny's name. // Function that will be called when notifier.Notify returns error. // If not specified, uses defaultErrorFunc. ErrorFunc ErrorFunc // contains filtered or unexported fields }
Nanny represents the main functionality with its `Handle` func. There should be only one nanny per process.
func (*Nanny) GetTimer ¶
GetTimer returns time.Timer when given program name is already registered or nil.
type Signal ¶
type Signal struct { // Name of program being monitored. // Should be unique for each instance of a program. Name string Notifier notifier.Notifier // What notifier to use. NextSignal time.Duration // Notify after reaching this timeout. Meta map[string]string // Optional callback function that will be called when notifier is called. CallbackFunc func(*Signal) }
Signal represents program calling nanny to notify with given notifier if this program does not call again within NextSignal + MaxDeviation.
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer encapsulates a signal and its timer
func (*Timer) MarshalJSON ¶
MarshalJSON marshals a nanny.Timer into JSON. Fields name, notifier, next_signal and meta are exported
Click to show internal directories.
Click to hide internal directories.