observer

package
v0.14.9 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 6

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

func NamedGroup(name string) Group

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.

func UUIDGroup added in v0.8.0

func UUIDGroup(id uuid.UUID) Group

UUIDGroup returns a Group with a fixed UUID.

Jump to

Keyboard shortcuts

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