Documentation
¶
Overview ¶
Package events is the catalog of things Pando tells subscribers about (R-364, issue #50, design 11).
One list, in code, of every event a subscription can name: its stable name, whether it is about one app or the whole installation, where it comes from, and the fields it carries. The API serves it, `make reference` writes docs/events.md from it, and the console's subscription form offers it, so none of those can describe an event the others do not.
This package is a leaf: it imports nothing from core, so the state package, the audit writer and the delivery engine can all depend on it.
Index ¶
Constants ¶
const ( AppStateChanged = "app.state_changed" DeploySucceeded = "deploy.succeeded" DeployFailed = "deploy.failed" BackupCreated = "backup.created" BackupFailed = "backup.failed" AdapterUnhealthy = "adapter.unhealthy" AdapterRecovered = "adapter.recovered" SubscriptionTest = "subscription.test" SubscriptionDisable = "subscription.disabled" )
Event names core writes directly, and the ones a trigger writes, as constants so a typo is a compile error rather than an event nobody can subscribe to.
Variables ¶
This section is empty.
Functions ¶
func ValidPattern ¶
ValidPattern reports whether p names an event or matches at least one.
A pattern is an event name, a prefix ending in ".*" (deploy.*), or "*". A pattern that matches nothing is refused rather than stored: a subscription to "deploy.fialed" would be a subscription that never fires, which is the worst way to find out about a typo.
Types ¶
type Def ¶
type Def struct {
Name string `json:"name"`
Scope Scope `json:"scope"`
Source Source `json:"source"`
Summary string `json:"summary"`
Fields []Field `json:"fields"`
// Actions are the audit actions this event is copied from, when Source
// is SourceAudit.
Actions []string `json:"-"`
}
Def is one catalogued event.
func Catalog ¶
func Catalog() []Def
Catalog returns every event, in documentation order. The slice is a copy.
type Source ¶
type Source string
Source is where Pando learns an event happened.
const ( // SourceAudit: copied from the audit log as the audit row is written, in // the same transaction. SourceAudit Source = "audit" // SourceState: written by a database trigger when a row changes. SourceState Source = "state" // SourceCore: written by core directly. SourceCore Source = "core" )