Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidApp = fmt.Errorf("invalid application provided")
ErrInvalidApp is returned by triggers when a non-existent app is requested.
var ErrNoChannel = fmt.Errorf("no channel to send request")
ErrNoChannel is returned when the go routine is stopped.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Name TriggerName Fn func(website.EventType) // most actions use this for triggers. C chan website.EventType // if provided, T is optional. T *time.Ticker // if provided, C is optional. Hide bool // prevent logging. }
Action defines a trigger/timer that can be executed.
type Config ¶
type Config struct { *website.Server // send trigger responses to website. *website.ClientInfo Snapshot *snapshot.Config Apps *apps.Apps Serial bool mnd.Logger // contains filtered or unexported fields }
Config is the input data shared by most triggers. Everything is mandatory.
func (*Config) Add ¶
Add adds a new action to our list of "Actions to run." actions are timers or triggers, or both.
func (*Config) Exec ¶
func (c *Config) Exec(event website.EventType, name TriggerName) bool
Exec runs a trigger. This is abastraction method used in a bunch of places.
func (*Config) Get ¶
func (c *Config) Get(name TriggerName) *Action
Get a trigger by unique name. May return nil, and that could cause a panic. We avoid panics by using a custom type with corresponding constants as input.
type TriggerName ¶
type TriggerName string
TriggerName makes sure triggers have a known name.
const TrigStop TriggerName = "Stopping all triggers and timers (reload)."
TrigStop is used to signal a stop/reload.
func (TriggerName) WithInstance ¶ added in v0.3.3
func (name TriggerName) WithInstance(instance int) TriggerName
WithInstance returns a trigger name with an instance ID.