Documentation ¶
Index ¶
- type Config
- type Engine
- func (p *Engine) Pause(ctx context.Context) error
- func (p *Engine) Receive(ctx context.Context, callbackID string, result notification.Result) error
- func (p *Engine) Resume(ctx context.Context) error
- func (p *Engine) Run(ctx context.Context) error
- func (p *Engine) Shutdown(ctx context.Context) error
- func (p *Engine) Start(ctx context.Context, d notification.Dest) error
- func (p *Engine) Stop(ctx context.Context, d notification.Dest) error
- func (p *Engine) Trigger()
- func (p *Engine) TriggerAndWaitNextCycle(ctx context.Context) error
- func (p *Engine) UpdateStatus(ctx context.Context, status *notification.MessageStatus) error
- func (p *Engine) WaitNextCycle(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { AlertLogStore alertlog.Store AlertStore alert.Store ContactMethodStore contactmethod.Store NotificationSender notification.Sender UserStore user.Store NotificationStore notification.Store NCStore notificationchannel.Store ConfigSource config.Source Keys keyring.Keys MaxMessages int DisableCycle bool }
Config contains parameters for controlling how the Engine operates.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine handles automatic escaltion of unacknowledged(triggered) alerts, as well as passing to-be-sent notifications to the notification.Sender.
Care is taken to ensure only one attempt is made per contact-method at a time, regardless of how many instances of the application may be running.
func NewEngine ¶
NewEngine will create a new Engine using the passed *sql.DB as a backend. Outgoing notifications will be passed to Sender.
Context is only used for preparing and initializing.
func (*Engine) Shutdown ¶
Shutdown will gracefully shutdown the processor, finishing any ongoing tasks.
func (*Engine) Start ¶ added in v0.25.0
Start will enable all associated contact methods of `value` with type `t`. This should be invoked if a user, for example, responds with `START` via sms.
func (*Engine) Stop ¶
Stop will disable all associated contact methods of `value` with type `t`. This should be invoked if a user, for example, responds with `STOP` via SMS.
func (*Engine) Trigger ¶
func (p *Engine) Trigger()
Trigger will force notifications to be processed immediately.
func (*Engine) TriggerAndWaitNextCycle ¶ added in v0.25.0
TriggerAndWaitNextCycle will force notifications to be processed immediately and will return after the next engine cycle starts and then finishes.
func (*Engine) UpdateStatus ¶
func (p *Engine) UpdateStatus(ctx context.Context, status *notification.MessageStatus) error
UpdateStatus will update the status of a message.