Documentation
¶
Overview ¶
Package eventdispatch passes the events of each topic to its handler in api.EventsOpts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedTopic = errors.New("unsupported event topic")
ErrUnsupportedTopic is returned by Handle for an event of a topic that is not supported.
Functions ¶
func ForwardingGuarded ¶
func ForwardingGuarded(opts *api.EventsOpts, forward func(topic string) bool) *api.EventsOpts
ForwardingGuarded returns a copy of opts whose handlers forward events only when forward allows their topic. It leaves missing topic handlers nil so events can reach the generic handler. It copies the topics slice and never changes opts, so guards for different clients do not stack.
func Handle ¶
Handle decodes the data of an event with the given topic, as sent on the events stream, and passes it to the topic's specific handler in the options, or failing that to their generic handler. It returns an error if the topic is not supported or the data does not decode.
func HasTopicHandler ¶
func HasTopicHandler(opts *api.EventsOpts, topic string) bool
HasTopicHandler reports whether the options carry a handler specific to the given topic.
Types ¶
This section is empty.