engine

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 29 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func NewEngine(ctx context.Context, db *sql.DB, c *Config) (*Engine, error)

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) Pause

func (p *Engine) Pause(ctx context.Context) error

Pause will attempt to gracefully stop engine processing.

func (*Engine) Receive

func (p *Engine) Receive(ctx context.Context, callbackID string, result notification.Result) error

Receive will process a notification result.

func (*Engine) Resume

func (p *Engine) Resume(ctx context.Context) error

Resume will allow the engine to resume processing.

func (*Engine) Run

func (p *Engine) Run(ctx context.Context) error

Run will being the engine loop.

func (*Engine) Shutdown

func (p *Engine) Shutdown(ctx context.Context) error

Shutdown will gracefully shutdown the processor, finishing any ongoing tasks.

func (*Engine) Stop

func (p *Engine) Stop(ctx context.Context, d notification.Dest) error

Stop will disable all associated contact methods associated with `value` of type `t`. This is 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) UpdateStatus

func (p *Engine) UpdateStatus(ctx context.Context, status *notification.MessageStatus) error

UpdateStatus will update the status of a message.

func (*Engine) WaitNextCycle

func (p *Engine) WaitNextCycle(ctx context.Context) error

WaitNextCycle will return after the next engine cycle starts and then finishes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL