Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(h eh.EventHandler) eh.EventHandler
Middleware creates an observer middleware with a random group.
func NewMiddleware ¶ added in v0.8.0
func NewMiddleware(group Group) func(eh.EventHandler) eh.EventHandler
NewMiddleware creates a middleware that lets multiple handlers handle an event depending on their group. It works by suffixing the group name to the handler type. To create an observer that is unique for every added handler use the RandomGroup. To create an observer per host use the HostnameGroup. To create handling groups manually use either the NamedGroup or UUIDGroup.
Types ¶
type Group ¶ added in v0.8.0
type Group interface { // Group returns the name of the observer group. Group() string }
Group provides groupings of observers by different criteria.
func HostnameGroup ¶ added in v0.8.0
func HostnameGroup() Group
HostnameGroup returns a Group for the hostname, useful to have an observer per host.
func NamedGroup ¶ added in v0.8.0
NamedGroup returns a Group with a fixed name.
func RandomGroup ¶ added in v0.8.0
func RandomGroup() Group
RandomGroup returns a Group from a random UUID, useful to have many completely separate observers.