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 ¶
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 ¶
type Group interface { // Group returns the name of the observer group. Group() string }
Group provides groupings of observers by different criteria.
func HostnameGroup ¶
func HostnameGroup() Group
HostnameGroup returns a Group for the hostname, useful to have an observer per host.
func RandomGroup ¶
func RandomGroup() Group
RandomGroup returns a Group from a random UUID, useful to have many completely separate observers.